File: | xlators/protocol/client/src/client-rpc-fops.c |
Location: | line 5540, column 20 |
Description: | Access to field 'cmd' results in a dereference of a null pointer (loaded from variable 'local') |
1 | /* | |||
2 | Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> | |||
3 | This file is part of GlusterFS. | |||
4 | ||||
5 | This file is licensed to you under your choice of the GNU Lesser | |||
6 | General Public License, version 3 or any later version (LGPLv3 or | |||
7 | later), or the GNU General Public License, version 2 (GPLv2), in all | |||
8 | cases as published by the Free Software Foundation. | |||
9 | */ | |||
10 | ||||
11 | #ifndef _CONFIG_H | |||
12 | #define _CONFIG_H | |||
13 | #include "config.h" | |||
14 | #endif | |||
15 | ||||
16 | #include "client.h" | |||
17 | #include "glusterfs3-xdr.h" | |||
18 | #include "glusterfs3.h" | |||
19 | #include "compat-errno.h" | |||
20 | ||||
21 | int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data); | |||
22 | void client_start_ping (void *data); | |||
23 | rpc_clnt_prog_t clnt3_3_fop_prog; | |||
24 | ||||
25 | ||||
26 | int | |||
27 | client_submit_vec_request (xlator_t *this, void *req, call_frame_t *frame, | |||
28 | rpc_clnt_prog_t *prog, int procnum, | |||
29 | fop_cbk_fn_t cbkfn, | |||
30 | struct iovec *payload, int payloadcnt, | |||
31 | struct iobref *iobref, xdrproc_t xdrproc) | |||
32 | { | |||
33 | int ret = 0; | |||
34 | clnt_conf_t *conf = NULL((void*)0); | |||
35 | struct iovec iov = {0, }; | |||
36 | struct iobuf *iobuf = NULL((void*)0); | |||
37 | int count = 0; | |||
38 | int start_ping = 0; | |||
39 | struct iobref *new_iobref = NULL((void*)0); | |||
40 | ssize_t xdr_size = 0; | |||
41 | struct rpc_req rpcreq = {0, }; | |||
42 | ||||
43 | start_ping = 0; | |||
44 | ||||
45 | conf = this->private; | |||
46 | ||||
47 | if (req && xdrproc) { | |||
48 | xdr_size = xdr_sizeof (xdrproc, req); | |||
49 | iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); | |||
50 | if (!iobuf) { | |||
51 | goto unwind; | |||
52 | }; | |||
53 | ||||
54 | new_iobref = iobref_new (); | |||
55 | if (!new_iobref) { | |||
56 | goto unwind; | |||
57 | } | |||
58 | ||||
59 | if (iobref != NULL((void*)0)) { | |||
60 | ret = iobref_merge (new_iobref, iobref); | |||
61 | if (ret != 0) { | |||
62 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot merge iobref passed from caller " "into new_iobref"); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 64, GF_LOG_WARNING, "cannot merge iobref passed from caller " "into new_iobref"); } while (0) | |||
63 | "cannot merge iobref passed from caller "do { do { if (0) printf ("cannot merge iobref passed from caller " "into new_iobref"); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 64, GF_LOG_WARNING, "cannot merge iobref passed from caller " "into new_iobref"); } while (0) | |||
64 | "into new_iobref")do { do { if (0) printf ("cannot merge iobref passed from caller " "into new_iobref"); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 64, GF_LOG_WARNING, "cannot merge iobref passed from caller " "into new_iobref"); } while (0); | |||
65 | } | |||
66 | } | |||
67 | ||||
68 | ret = iobref_add (new_iobref, iobuf); | |||
69 | if (ret != 0) { | |||
70 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot add iobuf into iobref"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 71, GF_LOG_WARNING, "cannot add iobuf into iobref"); } while (0) | |||
71 | "cannot add iobuf into iobref")do { do { if (0) printf ("cannot add iobuf into iobref"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 71, GF_LOG_WARNING, "cannot add iobuf into iobref"); } while (0); | |||
72 | goto unwind; | |||
73 | } | |||
74 | ||||
75 | iov.iov_base = iobuf->ptr; | |||
76 | iov.iov_len = iobuf_size (iobuf); | |||
77 | ||||
78 | /* Create the xdr payload */ | |||
79 | ret = xdr_serialize_generic (iov, req, xdrproc); | |||
80 | if (ret == -1) { | |||
81 | gf_log_callingfn ("", GF_LOG_WARNING,do { do { if (0) printf ("XDR function failed"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__, 82 , GF_LOG_WARNING, "XDR function failed"); } while (0) | |||
82 | "XDR function failed")do { do { if (0) printf ("XDR function failed"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__, 82 , GF_LOG_WARNING, "XDR function failed"); } while (0); | |||
83 | goto unwind; | |||
84 | } | |||
85 | ||||
86 | iov.iov_len = ret; | |||
87 | count = 1; | |||
88 | } | |||
89 | ||||
90 | /* Send the msg */ | |||
91 | ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count, | |||
92 | payload, payloadcnt, new_iobref, frame, NULL((void*)0), 0, | |||
93 | NULL((void*)0), 0, NULL((void*)0)); | |||
94 | if (ret < 0) { | |||
95 | gf_log (this->name, GF_LOG_DEBUG, "rpc_clnt_submit failed")do { do { if (0) printf ("rpc_clnt_submit failed"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 95, GF_LOG_DEBUG, "rpc_clnt_submit failed"); } while (0); | |||
96 | } | |||
97 | ||||
98 | if (ret == 0) { | |||
99 | pthread_mutex_lock (&conf->rpc->conn.lock); | |||
100 | { | |||
101 | if (!conf->rpc->conn.ping_started) { | |||
102 | start_ping = 1; | |||
103 | } | |||
104 | } | |||
105 | pthread_mutex_unlock (&conf->rpc->conn.lock); | |||
106 | } | |||
107 | ||||
108 | if (start_ping) | |||
109 | client_start_ping ((void *) this); | |||
110 | ||||
111 | if (new_iobref) | |||
112 | iobref_unref (new_iobref); | |||
113 | ||||
114 | if (iobuf) | |||
115 | iobuf_unref (iobuf); | |||
116 | ||||
117 | return ret; | |||
118 | ||||
119 | unwind: | |||
120 | rpcreq.rpc_status = -1; | |||
121 | cbkfn (&rpcreq, NULL((void*)0), 0, frame); | |||
122 | ||||
123 | if (new_iobref) | |||
124 | iobref_unref (new_iobref); | |||
125 | ||||
126 | if (iobuf) | |||
127 | iobuf_unref (iobuf); | |||
128 | ||||
129 | return ret; | |||
130 | } | |||
131 | ||||
132 | /* CBK */ | |||
133 | ||||
134 | int | |||
135 | client3_3_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
136 | void *myframe) | |||
137 | { | |||
138 | call_frame_t *frame = NULL((void*)0); | |||
139 | gfs3_symlink_rsp rsp = {0,}; | |||
140 | struct iatt stbuf = {0,}; | |||
141 | struct iatt preparent = {0,}; | |||
142 | struct iatt postparent = {0,}; | |||
143 | int ret = 0; | |||
144 | clnt_local_t *local = NULL((void*)0); | |||
145 | inode_t *inode = NULL((void*)0); | |||
146 | xlator_t *this = NULL((void*)0); | |||
147 | dict_t *xdata = NULL((void*)0); | |||
148 | ||||
149 | this = THIS(*__glusterfs_this_location()); | |||
150 | ||||
151 | frame = myframe; | |||
152 | ||||
153 | local = frame->local; | |||
154 | inode = local->loc.inode; | |||
155 | ||||
156 | if (-1 == req->rpc_status) { | |||
157 | rsp.op_ret = -1; | |||
158 | rsp.op_errno = ENOTCONN107; | |||
159 | goto out; | |||
160 | } | |||
161 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_symlink_rsp); | |||
162 | if (ret < 0) { | |||
163 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 163 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
164 | rsp.op_ret = -1; | |||
165 | rsp.op_errno = EINVAL22; | |||
166 | goto out; | |||
167 | } | |||
168 | ||||
169 | if (-1 != rsp.op_ret) { | |||
170 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
171 | ||||
172 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
173 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
174 | } | |||
175 | ||||
176 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 178, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 178, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
177 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 178, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 178, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
178 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 178, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 178, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
179 | ||||
180 | out: | |||
181 | if (rsp.op_ret == -1) { | |||
182 | /* no need to print the gfid, because it will be null, since | |||
183 | * symlink operation failed. | |||
184 | */ | |||
185 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 188, GF_LOG_WARNING, "remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0) | |||
186 | "remote operation failed: %s. Path: (%s to %s)",do { do { if (0) printf ("remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 188, GF_LOG_WARNING, "remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0) | |||
187 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 188, GF_LOG_WARNING, "remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0) | |||
188 | local->loc.path, local->loc2.path)do { do { if (0) printf ("remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 188, GF_LOG_WARNING, "remote operation failed: %s. Path: (%s to %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); | |||
189 | } | |||
190 | ||||
191 | CLIENT_STACK_UNWIND (symlink, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 193, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
192 | gf_error_to_errno (rsp.op_errno), inode, &stbuf,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 193, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
193 | &preparent, &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 193, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
194 | ||||
195 | free (rsp.xdata.xdata_val); | |||
196 | ||||
197 | if (xdata) | |||
198 | dict_unref (xdata); | |||
199 | ||||
200 | return 0; | |||
201 | } | |||
202 | ||||
203 | ||||
204 | int | |||
205 | client3_3_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
206 | void *myframe) | |||
207 | { | |||
208 | call_frame_t *frame = NULL((void*)0); | |||
209 | gfs3_mknod_rsp rsp = {0,}; | |||
210 | struct iatt stbuf = {0,}; | |||
211 | struct iatt preparent = {0,}; | |||
212 | struct iatt postparent = {0,}; | |||
213 | int ret = 0; | |||
214 | clnt_local_t *local = NULL((void*)0); | |||
215 | inode_t *inode = NULL((void*)0); | |||
216 | xlator_t *this = NULL((void*)0); | |||
217 | dict_t *xdata = NULL((void*)0); | |||
218 | ||||
219 | this = THIS(*__glusterfs_this_location()); | |||
220 | ||||
221 | frame = myframe; | |||
222 | ||||
223 | local = frame->local; | |||
224 | ||||
225 | inode = local->loc.inode; | |||
226 | ||||
227 | if (-1 == req->rpc_status) { | |||
228 | rsp.op_ret = -1; | |||
229 | rsp.op_errno = ENOTCONN107; | |||
230 | goto out; | |||
231 | } | |||
232 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mknod_rsp); | |||
233 | if (ret < 0) { | |||
234 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 234 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
235 | rsp.op_ret = -1; | |||
236 | rsp.op_errno = EINVAL22; | |||
237 | goto out; | |||
238 | } | |||
239 | ||||
240 | if (-1 != rsp.op_ret) { | |||
241 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
242 | ||||
243 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
244 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
245 | } | |||
246 | ||||
247 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 249, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 249, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
248 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 249, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 249, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
249 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 249, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 249, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
250 | ||||
251 | out: | |||
252 | if (rsp.op_ret == -1) { | |||
253 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 256, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
254 | "remote operation failed: %s. Path: %s",do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 256, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
255 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 256, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
256 | local->loc.path)do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 256, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); | |||
257 | } | |||
258 | ||||
259 | CLIENT_STACK_UNWIND (mknod, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 261, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
260 | gf_error_to_errno (rsp.op_errno), inode,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 261, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
261 | &stbuf, &preparent, &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 261, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
262 | ||||
263 | free (rsp.xdata.xdata_val); | |||
264 | ||||
265 | if (xdata) | |||
266 | dict_unref (xdata); | |||
267 | ||||
268 | return 0; | |||
269 | } | |||
270 | ||||
271 | int | |||
272 | client3_3_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
273 | void *myframe) | |||
274 | { | |||
275 | call_frame_t *frame = NULL((void*)0); | |||
276 | gfs3_mkdir_rsp rsp = {0,}; | |||
277 | struct iatt stbuf = {0,}; | |||
278 | struct iatt preparent = {0,}; | |||
279 | struct iatt postparent = {0,}; | |||
280 | int ret = 0; | |||
281 | clnt_local_t *local = NULL((void*)0); | |||
282 | inode_t *inode = NULL((void*)0); | |||
283 | xlator_t *this = NULL((void*)0); | |||
284 | dict_t *xdata = NULL((void*)0); | |||
285 | ||||
286 | this = THIS(*__glusterfs_this_location()); | |||
287 | ||||
288 | frame = myframe; | |||
289 | ||||
290 | local = frame->local; | |||
291 | inode = local->loc.inode; | |||
292 | ||||
293 | if (-1 == req->rpc_status) { | |||
294 | rsp.op_ret = -1; | |||
295 | rsp.op_errno = ENOTCONN107; | |||
296 | goto out; | |||
297 | } | |||
298 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_mkdir_rsp); | |||
299 | if (ret < 0) { | |||
300 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 300 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
301 | rsp.op_ret = -1; | |||
302 | rsp.op_errno = EINVAL22; | |||
303 | goto out; | |||
304 | } | |||
305 | ||||
306 | if (-1 != rsp.op_ret) { | |||
307 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
308 | ||||
309 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
310 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
311 | } | |||
312 | ||||
313 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 315, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 315, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
314 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 315, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 315, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
315 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 315, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 315, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
316 | ||||
317 | out: | |||
318 | if (rsp.op_ret == -1) { | |||
319 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 322, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
320 | "remote operation failed: %s. Path: %s",do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 322, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
321 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 322, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
322 | local->loc.path)do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 322, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); | |||
323 | } | |||
324 | ||||
325 | CLIENT_STACK_UNWIND (mkdir, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 327, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
326 | gf_error_to_errno (rsp.op_errno), inode,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 327, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
327 | &stbuf, &preparent, &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 327, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
328 | ||||
329 | free (rsp.xdata.xdata_val); | |||
330 | ||||
331 | if (xdata) | |||
332 | dict_unref (xdata); | |||
333 | ||||
334 | return 0; | |||
335 | } | |||
336 | ||||
337 | int | |||
338 | _copy_gfid_from_inode_holders (uuid_t gfid, loc_t *loc, fd_t *fd) | |||
339 | { | |||
340 | int ret = 0; | |||
341 | ||||
342 | if (fd && fd->inode && !uuid_is_null (fd->inode->gfid)) { | |||
343 | uuid_copy (gfid, fd->inode->gfid); | |||
344 | goto out; | |||
345 | } | |||
346 | ||||
347 | if (!loc) { | |||
348 | GF_ASSERT (0)do { if (!(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c" , __FUNCTION__, 348, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); | |||
349 | ret = -1; | |||
350 | goto out; | |||
351 | } | |||
352 | ||||
353 | if (loc->inode && !uuid_is_null (loc->inode->gfid)) { | |||
354 | uuid_copy (gfid, loc->inode->gfid); | |||
355 | } else if (!uuid_is_null (loc->gfid)) { | |||
356 | uuid_copy (gfid, loc->gfid); | |||
357 | } else { | |||
358 | GF_ASSERT (0)do { if (!(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c" , __FUNCTION__, 358, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); | |||
359 | ret = -1; | |||
360 | } | |||
361 | out: | |||
362 | return ret; | |||
363 | } | |||
364 | ||||
365 | int | |||
366 | client_add_fd_to_saved_fds (xlator_t *this, fd_t *fd, loc_t *loc, int32_t flags, | |||
367 | int64_t remote_fd, int is_dir) | |||
368 | { | |||
369 | int ret = 0; | |||
370 | uuid_t gfid = {0}; | |||
371 | clnt_conf_t *conf = NULL((void*)0); | |||
372 | clnt_fd_ctx_t *fdctx = NULL((void*)0); | |||
373 | ||||
374 | conf = this->private; | |||
375 | ret = _copy_gfid_from_inode_holders (gfid, loc, fd); | |||
376 | if (ret) { | |||
377 | ret = -EINVAL22; | |||
378 | goto out; | |||
379 | } | |||
380 | ||||
381 | fdctx = GF_CALLOC (1, sizeof (*fdctx),__gf_calloc (1, sizeof (*fdctx), gf_client_mt_clnt_fdctx_t) | |||
382 | gf_client_mt_clnt_fdctx_t)__gf_calloc (1, sizeof (*fdctx), gf_client_mt_clnt_fdctx_t); | |||
383 | if (!fdctx) { | |||
384 | ret = -ENOMEM12; | |||
385 | goto out; | |||
386 | } | |||
387 | ||||
388 | uuid_copy (fdctx->gfid, gfid); | |||
389 | fdctx->is_dir = is_dir; | |||
390 | fdctx->remote_fd = remote_fd; | |||
391 | fdctx->flags = flags; | |||
392 | fdctx->lk_ctx = fd_lk_ctx_ref (fd->lk_ctx); | |||
393 | fdctx->lk_heal_state = GF_LK_HEAL_DONE; | |||
394 | fdctx->reopen_done = client_default_reopen_done; | |||
395 | ||||
396 | INIT_LIST_HEAD (&fdctx->sfd_pos)do { (&fdctx->sfd_pos)->next = (&fdctx->sfd_pos )->prev = &fdctx->sfd_pos; } while (0); | |||
397 | INIT_LIST_HEAD (&fdctx->lock_list)do { (&fdctx->lock_list)->next = (&fdctx->lock_list )->prev = &fdctx->lock_list; } while (0); | |||
398 | ||||
399 | this_fd_set_ctx (fd, this, loc, fdctx); | |||
400 | ||||
401 | pthread_mutex_lock (&conf->lock); | |||
402 | { | |||
403 | list_add_tail (&fdctx->sfd_pos, &conf->saved_fds); | |||
404 | } | |||
405 | pthread_mutex_unlock (&conf->lock); | |||
406 | out: | |||
407 | return ret; | |||
408 | } | |||
409 | ||||
410 | int | |||
411 | client3_3_open_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
412 | void *myframe) | |||
413 | { | |||
414 | clnt_local_t *local = NULL((void*)0); | |||
415 | clnt_conf_t *conf = NULL((void*)0); | |||
416 | call_frame_t *frame = NULL((void*)0); | |||
417 | fd_t *fd = NULL((void*)0); | |||
418 | int ret = 0; | |||
419 | gfs3_open_rsp rsp = {0,}; | |||
420 | xlator_t *this = NULL((void*)0); | |||
421 | dict_t *xdata = NULL((void*)0); | |||
422 | ||||
423 | ||||
424 | this = THIS(*__glusterfs_this_location()); | |||
425 | ||||
426 | frame = myframe; | |||
427 | local = frame->local; | |||
428 | ||||
429 | conf = frame->this->private; | |||
430 | fd = local->fd; | |||
431 | ||||
432 | if (-1 == req->rpc_status) { | |||
433 | rsp.op_ret = -1; | |||
434 | rsp.op_errno = ENOTCONN107; | |||
435 | goto out; | |||
436 | } | |||
437 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_open_rsp); | |||
438 | if (ret < 0) { | |||
439 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 439 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
440 | rsp.op_ret = -1; | |||
441 | rsp.op_errno = EINVAL22; | |||
442 | goto out; | |||
443 | } | |||
444 | ||||
445 | if (-1 != rsp.op_ret) { | |||
446 | ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc, | |||
447 | local->flags, rsp.fd, 0); | |||
448 | if (ret) { | |||
449 | rsp.op_ret = -1; | |||
450 | rsp.op_errno = -ret; | |||
451 | goto out; | |||
452 | } | |||
453 | } | |||
454 | ||||
455 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 457, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 457, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
456 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 457, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 457, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
457 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 457, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 457, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
458 | ||||
459 | out: | |||
460 | if (rsp.op_ret == -1) { | |||
461 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 464, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
462 | "remote operation failed: %s. Path: %s (%s)",do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 464, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
463 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 464, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
464 | local->loc.path, loc_gfid_utoa (&local->loc))do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 464, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0); | |||
465 | } | |||
466 | ||||
467 | CLIENT_STACK_UNWIND (open, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_open_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 468, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_open_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
468 | gf_error_to_errno (rsp.op_errno), fd, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_open_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 468, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_open_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
469 | ||||
470 | free (rsp.xdata.xdata_val); | |||
471 | ||||
472 | if (xdata) | |||
473 | dict_unref (xdata); | |||
474 | ||||
475 | return 0; | |||
476 | } | |||
477 | ||||
478 | ||||
479 | int | |||
480 | client3_3_stat_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
481 | void *myframe) | |||
482 | { | |||
483 | gfs3_stat_rsp rsp = {0,}; | |||
484 | call_frame_t *frame = NULL((void*)0); | |||
485 | struct iatt iatt = {0,}; | |||
486 | int ret = 0; | |||
487 | xlator_t *this = NULL((void*)0); | |||
488 | dict_t *xdata = NULL((void*)0); | |||
489 | ||||
490 | ||||
491 | this = THIS(*__glusterfs_this_location()); | |||
492 | ||||
493 | frame = myframe; | |||
494 | ||||
495 | if (-1 == req->rpc_status) { | |||
496 | rsp.op_ret = -1; | |||
497 | rsp.op_errno = ENOTCONN107; | |||
498 | goto out; | |||
499 | } | |||
500 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_stat_rsp); | |||
501 | if (ret < 0) { | |||
502 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 502 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
503 | rsp.op_ret = -1; | |||
504 | rsp.op_errno = EINVAL22; | |||
505 | goto out; | |||
506 | } | |||
507 | ||||
508 | if (-1 != rsp.op_ret) { | |||
509 | gf_stat_to_iatt (&rsp.stat, &iatt); | |||
510 | } | |||
511 | ||||
512 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 514, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 514, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
513 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 514, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 514, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
514 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 514, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 514, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
515 | ||||
516 | out: | |||
517 | if (rsp.op_ret == -1) { | |||
518 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 519, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
519 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 519, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
520 | } | |||
521 | ||||
522 | CLIENT_STACK_UNWIND (stat, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_stat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 523, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_stat_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &iatt, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
523 | gf_error_to_errno (rsp.op_errno), &iatt, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_stat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 523, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_stat_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &iatt, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
524 | ||||
525 | free (rsp.xdata.xdata_val); | |||
526 | ||||
527 | if (xdata) | |||
528 | dict_unref (xdata); | |||
529 | ||||
530 | return 0; | |||
531 | } | |||
532 | ||||
533 | int | |||
534 | client3_3_readlink_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
535 | void *myframe) | |||
536 | { | |||
537 | gfs3_readlink_rsp rsp = {0,}; | |||
538 | call_frame_t *frame = NULL((void*)0); | |||
539 | struct iatt iatt = {0,}; | |||
540 | int ret = 0; | |||
541 | xlator_t *this = NULL((void*)0); | |||
542 | dict_t *xdata = NULL((void*)0); | |||
543 | ||||
544 | ||||
545 | this = THIS(*__glusterfs_this_location()); | |||
546 | ||||
547 | frame = myframe; | |||
548 | ||||
549 | if (-1 == req->rpc_status) { | |||
550 | rsp.op_ret = -1; | |||
551 | rsp.op_errno = ENOTCONN107; | |||
552 | goto out; | |||
553 | } | |||
554 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readlink_rsp); | |||
555 | if (ret < 0) { | |||
556 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 556 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
557 | rsp.op_ret = -1; | |||
558 | rsp.op_errno = EINVAL22; | |||
559 | goto out; | |||
560 | } | |||
561 | ||||
562 | if (-1 != rsp.op_ret) { | |||
563 | gf_stat_to_iatt (&rsp.buf, &iatt); | |||
564 | } | |||
565 | ||||
566 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 568, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 568, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
567 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 568, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 568, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
568 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 568, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 568, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
569 | ||||
570 | out: | |||
571 | if (rsp.op_ret == -1) { | |||
572 | gf_log (this->name, (gf_error_to_errno(rsp.op_errno) == ENOENT)?do { do { if (0) printf ("remote operation failed:" " %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 574, (gf_error_to_errno (rsp.op_errno) == 2)? GF_LOG_DEBUG:GF_LOG_WARNING, "remote operation failed:" " %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0) | |||
573 | GF_LOG_DEBUG:GF_LOG_WARNING, "remote operation failed:"do { do { if (0) printf ("remote operation failed:" " %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 574, (gf_error_to_errno (rsp.op_errno) == 2)? GF_LOG_DEBUG:GF_LOG_WARNING, "remote operation failed:" " %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0) | |||
574 | " %s", strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed:" " %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 574, (gf_error_to_errno (rsp.op_errno) == 2)? GF_LOG_DEBUG:GF_LOG_WARNING, "remote operation failed:" " %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); | |||
575 | } | |||
576 | ||||
577 | CLIENT_STACK_UNWIND (readlink, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 579, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readlink_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. path, &iatt, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
578 | gf_error_to_errno (rsp.op_errno), rsp.path,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 579, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readlink_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. path, &iatt, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
579 | &iatt, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 579, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readlink_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. path, &iatt, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
580 | ||||
581 | /* This is allocated by the libc while decoding RPC msg */ | |||
582 | /* Hence no 'GF_FREE', but just 'free' */ | |||
583 | free (rsp.path); | |||
584 | ||||
585 | free (rsp.xdata.xdata_val); | |||
586 | ||||
587 | if (xdata) | |||
588 | dict_unref (xdata); | |||
589 | ||||
590 | return 0; | |||
591 | } | |||
592 | ||||
593 | int | |||
594 | client3_3_unlink_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
595 | void *myframe) | |||
596 | { | |||
597 | call_frame_t *frame = NULL((void*)0); | |||
598 | gfs3_unlink_rsp rsp = {0,}; | |||
599 | struct iatt preparent = {0,}; | |||
600 | struct iatt postparent = {0,}; | |||
601 | int ret = 0; | |||
602 | xlator_t *this = NULL((void*)0); | |||
603 | dict_t *xdata = NULL((void*)0); | |||
604 | ||||
605 | ||||
606 | this = THIS(*__glusterfs_this_location()); | |||
607 | ||||
608 | frame = myframe; | |||
609 | ||||
610 | if (-1 == req->rpc_status) { | |||
611 | rsp.op_ret = -1; | |||
612 | rsp.op_errno = ENOTCONN107; | |||
613 | goto out; | |||
614 | } | |||
615 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_unlink_rsp); | |||
616 | if (ret < 0) { | |||
617 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 617 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
618 | rsp.op_ret = -1; | |||
619 | rsp.op_errno = EINVAL22; | |||
620 | goto out; | |||
621 | } | |||
622 | ||||
623 | if (-1 != rsp.op_ret) { | |||
624 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
625 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
626 | } | |||
627 | ||||
628 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 630, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 630, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
629 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 630, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 630, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
630 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 630, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 630, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
631 | ||||
632 | out: | |||
633 | if (rsp.op_ret == -1) { | |||
634 | gf_log (this->name,do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 638, ((gf_error_to_errno (rsp.op_errno) == 2) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s" , strerror (gf_error_to_errno (rsp.op_errno))); } while (0) | |||
635 | ((gf_error_to_errno (rsp.op_errno) == ENOENT)do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 638, ((gf_error_to_errno (rsp.op_errno) == 2) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s" , strerror (gf_error_to_errno (rsp.op_errno))); } while (0) | |||
636 | ? GF_LOG_DEBUG : GF_LOG_WARNING),do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 638, ((gf_error_to_errno (rsp.op_errno) == 2) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s" , strerror (gf_error_to_errno (rsp.op_errno))); } while (0) | |||
637 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 638, ((gf_error_to_errno (rsp.op_errno) == 2) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s" , strerror (gf_error_to_errno (rsp.op_errno))); } while (0) | |||
638 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 638, ((gf_error_to_errno (rsp.op_errno) == 2) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s" , strerror (gf_error_to_errno (rsp.op_errno))); } while (0); | |||
639 | } | |||
640 | ||||
641 | CLIENT_STACK_UNWIND (unlink, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 643, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &preparent, & postparent, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
642 | gf_error_to_errno (rsp.op_errno), &preparent,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 643, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &preparent, & postparent, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
643 | &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 643, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &preparent, & postparent, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
644 | ||||
645 | free (rsp.xdata.xdata_val); | |||
646 | ||||
647 | if (xdata) | |||
648 | dict_unref (xdata); | |||
649 | ||||
650 | return 0; | |||
651 | } | |||
652 | ||||
653 | int | |||
654 | client3_3_rmdir_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
655 | void *myframe) | |||
656 | { | |||
657 | gfs3_rmdir_rsp rsp = {0,}; | |||
658 | call_frame_t *frame = NULL((void*)0); | |||
659 | struct iatt preparent = {0,}; | |||
660 | struct iatt postparent = {0,}; | |||
661 | int ret = 0; | |||
662 | xlator_t *this = NULL((void*)0); | |||
663 | dict_t *xdata = NULL((void*)0); | |||
664 | ||||
665 | ||||
666 | this = THIS(*__glusterfs_this_location()); | |||
667 | ||||
668 | frame = myframe; | |||
669 | ||||
670 | if (-1 == req->rpc_status) { | |||
671 | rsp.op_ret = -1; | |||
672 | rsp.op_errno = ENOTCONN107; | |||
673 | goto out; | |||
674 | } | |||
675 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rmdir_rsp); | |||
676 | if (ret < 0) { | |||
677 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 677 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
678 | rsp.op_ret = -1; | |||
679 | rsp.op_errno = EINVAL22; | |||
680 | goto out; | |||
681 | } | |||
682 | ||||
683 | if (-1 != rsp.op_ret) { | |||
684 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
685 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
686 | } | |||
687 | ||||
688 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 690, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 690, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
689 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 690, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 690, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
690 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 690, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 690, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
691 | ||||
692 | out: | |||
693 | if (rsp.op_ret == -1) { | |||
694 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 695, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
695 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 695, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
696 | } | |||
697 | CLIENT_STACK_UNWIND (rmdir, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 699, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &preparent, & postparent, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
698 | gf_error_to_errno (rsp.op_errno), &preparent,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 699, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &preparent, & postparent, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
699 | &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 699, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &preparent, & postparent, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
700 | ||||
701 | free (rsp.xdata.xdata_val); | |||
702 | ||||
703 | if (xdata) | |||
704 | dict_unref (xdata); | |||
705 | ||||
706 | return 0; | |||
707 | } | |||
708 | ||||
709 | ||||
710 | int | |||
711 | client3_3_truncate_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
712 | void *myframe) | |||
713 | { | |||
714 | gfs3_truncate_rsp rsp = {0,}; | |||
715 | call_frame_t *frame = NULL((void*)0); | |||
716 | struct iatt prestat = {0,}; | |||
717 | struct iatt poststat = {0,}; | |||
718 | int ret = 0; | |||
719 | xlator_t *this = NULL((void*)0); | |||
720 | dict_t *xdata = NULL((void*)0); | |||
721 | ||||
722 | ||||
723 | this = THIS(*__glusterfs_this_location()); | |||
724 | ||||
725 | frame = myframe; | |||
726 | ||||
727 | if (-1 == req->rpc_status) { | |||
728 | rsp.op_ret = -1; | |||
729 | rsp.op_errno = ENOTCONN107; | |||
730 | goto out; | |||
731 | } | |||
732 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp); | |||
733 | if (ret < 0) { | |||
734 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 734 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
735 | rsp.op_ret = -1; | |||
736 | rsp.op_errno = EINVAL22; | |||
737 | goto out; | |||
738 | } | |||
739 | ||||
740 | if (-1 != rsp.op_ret) { | |||
741 | gf_stat_to_iatt (&rsp.prestat, &prestat); | |||
742 | gf_stat_to_iatt (&rsp.poststat, &poststat); | |||
743 | } | |||
744 | ||||
745 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 747, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 747, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
746 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 747, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 747, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
747 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 747, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 747, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
748 | ||||
749 | out: | |||
750 | if (rsp.op_ret == -1) { | |||
751 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 752, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
752 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 752, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
753 | } | |||
754 | CLIENT_STACK_UNWIND (truncate, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 756, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
755 | gf_error_to_errno (rsp.op_errno), &prestat,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 756, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
756 | &poststat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 756, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
757 | ||||
758 | free (rsp.xdata.xdata_val); | |||
759 | ||||
760 | if (xdata) | |||
761 | dict_unref (xdata); | |||
762 | ||||
763 | return 0; | |||
764 | } | |||
765 | ||||
766 | ||||
767 | int | |||
768 | client3_3_statfs_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
769 | void *myframe) | |||
770 | { | |||
771 | gfs3_statfs_rsp rsp = {0,}; | |||
772 | call_frame_t *frame = NULL((void*)0); | |||
773 | struct statvfs statfs = {0,}; | |||
774 | int ret = 0; | |||
775 | xlator_t *this = NULL((void*)0); | |||
776 | dict_t *xdata = NULL((void*)0); | |||
777 | ||||
778 | ||||
779 | this = THIS(*__glusterfs_this_location()); | |||
780 | ||||
781 | frame = myframe; | |||
782 | ||||
783 | if (-1 == req->rpc_status) { | |||
784 | rsp.op_ret = -1; | |||
785 | rsp.op_errno = ENOTCONN107; | |||
786 | goto out; | |||
787 | } | |||
788 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_statfs_rsp); | |||
789 | if (ret < 0) { | |||
790 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 790 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
791 | rsp.op_ret = -1; | |||
792 | rsp.op_errno = EINVAL22; | |||
793 | goto out; | |||
794 | } | |||
795 | ||||
796 | if (-1 != rsp.op_ret) { | |||
797 | gf_statfs_to_statfs (&rsp.statfs, &statfs); | |||
798 | } | |||
799 | ||||
800 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 802, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 802, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
801 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 802, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 802, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
802 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 802, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 802, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
803 | ||||
804 | out: | |||
805 | if (rsp.op_ret == -1) { | |||
806 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 807, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
807 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 807, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
808 | } | |||
809 | CLIENT_STACK_UNWIND (statfs, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_statfs_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 810, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_statfs_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &statfs, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
810 | gf_error_to_errno (rsp.op_errno), &statfs, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_statfs_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 810, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_statfs_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &statfs, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
811 | ||||
812 | free (rsp.xdata.xdata_val); | |||
813 | ||||
814 | if (xdata) | |||
815 | dict_unref (xdata); | |||
816 | ||||
817 | return 0; | |||
818 | } | |||
819 | ||||
820 | ||||
821 | int | |||
822 | client3_3_writev_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
823 | void *myframe) | |||
824 | { | |||
825 | gfs3_write_rsp rsp = {0,}; | |||
826 | call_frame_t *frame = NULL((void*)0); | |||
827 | struct iatt prestat = {0,}; | |||
828 | struct iatt poststat = {0,}; | |||
829 | int ret = 0; | |||
830 | xlator_t *this = NULL((void*)0); | |||
831 | dict_t *xdata = NULL((void*)0); | |||
832 | clnt_local_t *local = NULL((void*)0); | |||
833 | ||||
834 | ||||
835 | this = THIS(*__glusterfs_this_location()); | |||
836 | ||||
837 | frame = myframe; | |||
838 | local = frame->local; | |||
839 | ||||
840 | if (-1 == req->rpc_status) { | |||
841 | rsp.op_ret = -1; | |||
842 | rsp.op_errno = ENOTCONN107; | |||
843 | goto out; | |||
844 | } | |||
845 | ||||
846 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp); | |||
847 | if (ret < 0) { | |||
848 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 848 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
849 | rsp.op_ret = -1; | |||
850 | rsp.op_errno = EINVAL22; | |||
851 | goto out; | |||
852 | } | |||
853 | ||||
854 | if (-1 != rsp.op_ret) { | |||
855 | gf_stat_to_iatt (&rsp.prestat, &prestat); | |||
856 | gf_stat_to_iatt (&rsp.poststat, &poststat); | |||
857 | } | |||
858 | ||||
859 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 861, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 861, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
860 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 861, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 861, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
861 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 861, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 861, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
862 | ||||
863 | out: | |||
864 | if (rsp.op_ret == -1) { | |||
865 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 866, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
866 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 866, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
867 | } else if (rsp.op_ret >= 0) { | |||
868 | if (local->attempt_reopen) | |||
869 | client_attempt_reopen (local->fd, this); | |||
870 | } | |||
871 | CLIENT_STACK_UNWIND (writev, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 873, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_writev_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
872 | gf_error_to_errno (rsp.op_errno), &prestat,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 873, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_writev_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
873 | &poststat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 873, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_writev_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
874 | ||||
875 | free (rsp.xdata.xdata_val); | |||
876 | ||||
877 | if (xdata) | |||
878 | dict_unref (xdata); | |||
879 | ||||
880 | return 0; | |||
881 | } | |||
882 | ||||
883 | int | |||
884 | client3_3_flush_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
885 | void *myframe) | |||
886 | { | |||
887 | call_frame_t *frame = NULL((void*)0); | |||
888 | clnt_local_t *local = NULL((void*)0); | |||
889 | xlator_t *this = NULL((void*)0); | |||
890 | dict_t *xdata = NULL((void*)0); | |||
891 | ||||
892 | gf_common_rsp rsp = {0,}; | |||
893 | int ret = 0; | |||
894 | ||||
895 | frame = myframe; | |||
896 | this = THIS(*__glusterfs_this_location()); | |||
897 | local = frame->local; | |||
898 | ||||
899 | if (-1 == req->rpc_status) { | |||
900 | rsp.op_ret = -1; | |||
901 | rsp.op_errno = ENOTCONN107; | |||
902 | goto out; | |||
903 | } | |||
904 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
905 | if (ret < 0) { | |||
906 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 906 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
907 | rsp.op_ret = -1; | |||
908 | rsp.op_errno = EINVAL22; | |||
909 | goto out; | |||
910 | } | |||
911 | ||||
912 | if (rsp.op_ret >= 0 && !fd_is_anonymous (local->fd)) { | |||
913 | /* Delete all saved locks of the owner issuing flush */ | |||
914 | ret = delete_granted_locks_owner (local->fd, &local->owner); | |||
915 | gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("deleting locks of owner (%s) returned %d" , lkowner_utoa (&local->owner), ret); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 917, GF_LOG_TRACE , "deleting locks of owner (%s) returned %d", lkowner_utoa (& local->owner), ret); } while (0) | |||
916 | "deleting locks of owner (%s) returned %d",do { do { if (0) printf ("deleting locks of owner (%s) returned %d" , lkowner_utoa (&local->owner), ret); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 917, GF_LOG_TRACE , "deleting locks of owner (%s) returned %d", lkowner_utoa (& local->owner), ret); } while (0) | |||
917 | lkowner_utoa (&local->owner), ret)do { do { if (0) printf ("deleting locks of owner (%s) returned %d" , lkowner_utoa (&local->owner), ret); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 917, GF_LOG_TRACE , "deleting locks of owner (%s) returned %d", lkowner_utoa (& local->owner), ret); } while (0); | |||
918 | } | |||
919 | ||||
920 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 922, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 922, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
921 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 922, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 922, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
922 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 922, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 922, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
923 | ||||
924 | out: | |||
925 | if (rsp.op_ret == -1) { | |||
926 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 928, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
927 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 928, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
928 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 928, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
929 | } | |||
930 | CLIENT_STACK_UNWIND (flush, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_flush_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 931, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_flush_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
931 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_flush_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 931, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_flush_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
932 | ||||
933 | free (rsp.xdata.xdata_val); | |||
934 | ||||
935 | if (xdata) | |||
936 | dict_unref (xdata); | |||
937 | ||||
938 | return 0; | |||
939 | } | |||
940 | ||||
941 | int | |||
942 | client3_3_fsync_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
943 | void *myframe) | |||
944 | { | |||
945 | gfs3_fsync_rsp rsp = {0,}; | |||
946 | call_frame_t *frame = NULL((void*)0); | |||
947 | struct iatt prestat = {0,}; | |||
948 | struct iatt poststat = {0,}; | |||
949 | int ret = 0; | |||
950 | xlator_t *this = NULL((void*)0); | |||
951 | dict_t *xdata = NULL((void*)0); | |||
952 | ||||
953 | ||||
954 | this = THIS(*__glusterfs_this_location()); | |||
955 | ||||
956 | frame = myframe; | |||
957 | ||||
958 | if (-1 == req->rpc_status) { | |||
959 | rsp.op_ret = -1; | |||
960 | rsp.op_errno = ENOTCONN107; | |||
961 | goto out; | |||
962 | } | |||
963 | ||||
964 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_truncate_rsp); | |||
965 | if (ret < 0) { | |||
966 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 966 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
967 | rsp.op_ret = -1; | |||
968 | rsp.op_errno = EINVAL22; | |||
969 | goto out; | |||
970 | } | |||
971 | ||||
972 | if (-1 != rsp.op_ret) { | |||
973 | gf_stat_to_iatt (&rsp.prestat, &prestat); | |||
974 | gf_stat_to_iatt (&rsp.poststat, &poststat); | |||
975 | } | |||
976 | ||||
977 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 979, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 979, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
978 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 979, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 979, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
979 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 979, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 979, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
980 | ||||
981 | out: | |||
982 | if (rsp.op_ret == -1) { | |||
983 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 984, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
984 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 984, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
985 | } | |||
986 | CLIENT_STACK_UNWIND (fsync, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsync_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 988, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsync_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
987 | gf_error_to_errno (rsp.op_errno), &prestat,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsync_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 988, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsync_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
988 | &poststat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsync_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 988, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsync_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
989 | ||||
990 | free (rsp.xdata.xdata_val); | |||
991 | ||||
992 | if (xdata) | |||
993 | dict_unref (xdata); | |||
994 | ||||
995 | return 0; | |||
996 | } | |||
997 | ||||
998 | int | |||
999 | client3_3_setxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1000 | void *myframe) | |||
1001 | { | |||
1002 | call_frame_t *frame = NULL((void*)0); | |||
1003 | gf_common_rsp rsp = {0,}; | |||
1004 | int ret = 0; | |||
1005 | xlator_t *this = NULL((void*)0); | |||
1006 | dict_t *xdata = NULL((void*)0); | |||
1007 | int op_errno = EINVAL22; | |||
1008 | ||||
1009 | this = THIS(*__glusterfs_this_location()); | |||
1010 | ||||
1011 | frame = myframe; | |||
1012 | ||||
1013 | if (-1 == req->rpc_status) { | |||
1014 | rsp.op_ret = -1; | |||
1015 | rsp.op_errno = ENOTCONN107; | |||
1016 | goto out; | |||
1017 | } | |||
1018 | ||||
1019 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1020 | if (ret < 0) { | |||
1021 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1021 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1022 | rsp.op_ret = -1; | |||
1023 | rsp.op_errno = EINVAL22; | |||
1024 | goto out; | |||
1025 | } | |||
1026 | ||||
1027 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1029, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1029, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1028 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1029, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1029, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1029 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1029, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1029, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1030 | ||||
1031 | out: | |||
1032 | op_errno = gf_error_to_errno (rsp.op_errno); | |||
1033 | if (rsp.op_ret == -1) { | |||
1034 | gf_log (this->name, ((op_errno == ENOTSUP) ?do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1037, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1035 | GF_LOG_DEBUG : GF_LOG_WARNING),do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1037, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1036 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1037, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1037 | strerror (op_errno))do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1037, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0); | |||
1038 | } | |||
1039 | CLIENT_STACK_UNWIND (setxattr, frame, rsp.op_ret, op_errno, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1039, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, op_errno, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1040 | ||||
1041 | free (rsp.xdata.xdata_val); | |||
1042 | ||||
1043 | if (xdata) | |||
1044 | dict_unref (xdata); | |||
1045 | ||||
1046 | return 0; | |||
1047 | } | |||
1048 | ||||
1049 | int | |||
1050 | client3_3_getxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1051 | void *myframe) | |||
1052 | { | |||
1053 | call_frame_t *frame = NULL((void*)0); | |||
1054 | dict_t *dict = NULL((void*)0); | |||
1055 | int op_errno = EINVAL22; | |||
1056 | gfs3_getxattr_rsp rsp = {0,}; | |||
1057 | int ret = 0; | |||
1058 | clnt_local_t *local = NULL((void*)0); | |||
1059 | xlator_t *this = NULL((void*)0); | |||
1060 | dict_t *xdata = NULL((void*)0); | |||
1061 | ||||
1062 | ||||
1063 | this = THIS(*__glusterfs_this_location()); | |||
1064 | ||||
1065 | frame = myframe; | |||
1066 | local = frame->local; | |||
1067 | ||||
1068 | if (-1 == req->rpc_status) { | |||
1069 | rsp.op_ret = -1; | |||
1070 | op_errno = ENOTCONN107; | |||
1071 | goto out; | |||
1072 | } | |||
1073 | ||||
1074 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_getxattr_rsp); | |||
1075 | if (ret < 0) { | |||
1076 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1076 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1077 | rsp.op_ret = -1; | |||
1078 | op_errno = EINVAL22; | |||
1079 | goto out; | |||
1080 | } | |||
1081 | ||||
1082 | op_errno = gf_error_to_errno (rsp.op_errno); | |||
1083 | if (-1 != rsp.op_ret) { | |||
1084 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, dict,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1087, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1087, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1085 | (rsp.dict.dict_val),do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1087, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1087, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1086 | (rsp.dict.dict_len), rsp.op_ret,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1087, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1087, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1087 | op_errno, out)do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1087, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1087, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0); | |||
1088 | } | |||
1089 | ||||
1090 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1092, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1092, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1091 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1092, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1092, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1092 | op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1092, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1092, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0); | |||
1093 | ||||
1094 | out: | |||
1095 | if (rsp.op_ret == -1) { | |||
1096 | gf_log (this->name, (((op_errno == ENOTSUP) ||do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1097 | (op_errno == ENODATA) ||do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1098 | (op_errno == ENOENT)) ?do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1099 | GF_LOG_DEBUG : GF_LOG_WARNING),do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1100 | "remote operation failed: %s. Path: %s (%s). Key: %s",do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1101 | strerror (op_errno),do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1102 | local->loc.path, loc_gfid_utoa (&local->loc),do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0) | |||
1103 | (local->name) ? local->name : "(null)")do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1103, (((op_errno == 95) || (op_errno == 61) || (op_errno == 2)) ? GF_LOG_DEBUG : GF_LOG_WARNING), "remote operation failed: %s. Path: %s (%s). Key: %s" , strerror (op_errno), local->loc.path, loc_gfid_utoa (& local->loc), (local->name) ? local->name : "(null)") ; } while (0); | |||
1104 | } | |||
1105 | ||||
1106 | CLIENT_STACK_UNWIND (getxattr, frame, rsp.op_ret, op_errno, dict, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1106, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_getxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, op_errno, dict, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1107 | ||||
1108 | /* don't use GF_FREE, this memory was allocated by libc */ | |||
1109 | free (rsp.dict.dict_val); | |||
1110 | ||||
1111 | free (rsp.xdata.xdata_val); | |||
1112 | ||||
1113 | if (xdata) | |||
1114 | dict_unref (xdata); | |||
1115 | ||||
1116 | if (dict) | |||
1117 | dict_unref (dict); | |||
1118 | ||||
1119 | return 0; | |||
1120 | } | |||
1121 | ||||
1122 | int | |||
1123 | client3_3_fgetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1124 | void *myframe) | |||
1125 | { | |||
1126 | call_frame_t *frame = NULL((void*)0); | |||
1127 | dict_t *dict = NULL((void*)0); | |||
1128 | gfs3_fgetxattr_rsp rsp = {0,}; | |||
1129 | int ret = 0; | |||
1130 | int op_errno = EINVAL22; | |||
1131 | clnt_local_t *local = NULL((void*)0); | |||
1132 | xlator_t *this = NULL((void*)0); | |||
1133 | dict_t *xdata = NULL((void*)0); | |||
1134 | ||||
1135 | ||||
1136 | this = THIS(*__glusterfs_this_location()); | |||
1137 | ||||
1138 | frame = myframe; | |||
1139 | local = frame->local; | |||
1140 | ||||
1141 | if (-1 == req->rpc_status) { | |||
1142 | rsp.op_ret = -1; | |||
1143 | op_errno = ENOTCONN107; | |||
1144 | goto out; | |||
1145 | } | |||
1146 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fgetxattr_rsp); | |||
1147 | if (ret < 0) { | |||
1148 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1148 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1149 | rsp.op_ret = -1; | |||
1150 | op_errno = EINVAL22; | |||
1151 | goto out; | |||
1152 | } | |||
1153 | ||||
1154 | op_errno = gf_error_to_errno (rsp.op_errno); | |||
1155 | if (-1 != rsp.op_ret) { | |||
1156 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, dict,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1159, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1159, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1157 | (rsp.dict.dict_val),do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1159, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1159, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1158 | (rsp.dict.dict_len), rsp.op_ret,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1159, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1159, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1159 | op_errno, out)do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1159, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1159, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0); | |||
1160 | } | |||
1161 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1163, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1163, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1162 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1163, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1163, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1163 | op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1163, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1163, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0); | |||
1164 | ||||
1165 | out: | |||
1166 | if (rsp.op_ret == -1) { | |||
1167 | gf_log (this->name, ((op_errno == ENOTSUP) ?do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1170, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1168 | GF_LOG_DEBUG : GF_LOG_WARNING),do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1170, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1169 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1170, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1170 | strerror (op_errno))do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1170, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0); | |||
1171 | } | |||
1172 | ||||
1173 | CLIENT_STACK_UNWIND (fgetxattr, frame, rsp.op_ret, op_errno, dict, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fgetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1173, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fgetxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, op_errno, dict, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1174 | ||||
1175 | free (rsp.dict.dict_val); | |||
1176 | ||||
1177 | free (rsp.xdata.xdata_val); | |||
1178 | ||||
1179 | if (xdata) | |||
1180 | dict_unref (xdata); | |||
1181 | ||||
1182 | if (dict) | |||
1183 | dict_unref (dict); | |||
1184 | ||||
1185 | return 0; | |||
1186 | } | |||
1187 | ||||
1188 | int | |||
1189 | client3_3_removexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1190 | void *myframe) | |||
1191 | { | |||
1192 | call_frame_t *frame = NULL((void*)0); | |||
1193 | gf_common_rsp rsp = {0,}; | |||
1194 | int ret = 0; | |||
1195 | xlator_t *this = NULL((void*)0); | |||
1196 | dict_t *xdata = NULL((void*)0); | |||
1197 | ||||
1198 | this = THIS(*__glusterfs_this_location()); | |||
1199 | ||||
1200 | frame = myframe; | |||
1201 | ||||
1202 | if (-1 == req->rpc_status) { | |||
1203 | rsp.op_ret = -1; | |||
1204 | rsp.op_errno = ENOTCONN107; | |||
1205 | goto out; | |||
1206 | } | |||
1207 | ||||
1208 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1209 | if (ret < 0) { | |||
1210 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1210 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1211 | rsp.op_ret = -1; | |||
1212 | rsp.op_errno = EINVAL22; | |||
1213 | goto out; | |||
1214 | } | |||
1215 | ||||
1216 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1218, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1218, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1217 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1218, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1218, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1218 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1218, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1218, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1219 | ||||
1220 | out: | |||
1221 | if (rsp.op_ret == -1) { | |||
1222 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1223, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1223 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1223, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1224 | } | |||
1225 | ||||
1226 | CLIENT_STACK_UNWIND (removexattr, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1227, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root->stack_lock); { _parent->ref_count --; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1227 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1227, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root->stack_lock); { _parent->ref_count --; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1228 | ||||
1229 | free (rsp.xdata.xdata_val); | |||
1230 | ||||
1231 | if (xdata) | |||
1232 | dict_unref (xdata); | |||
1233 | ||||
1234 | return 0; | |||
1235 | } | |||
1236 | ||||
1237 | int | |||
1238 | client3_3_fremovexattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1239 | void *myframe) | |||
1240 | { | |||
1241 | call_frame_t *frame = NULL((void*)0); | |||
1242 | gf_common_rsp rsp = {0,}; | |||
1243 | int ret = 0; | |||
1244 | xlator_t *this = NULL((void*)0); | |||
1245 | dict_t *xdata = NULL((void*)0); | |||
1246 | ||||
1247 | ||||
1248 | this = THIS(*__glusterfs_this_location()); | |||
1249 | ||||
1250 | frame = myframe; | |||
1251 | ||||
1252 | if (-1 == req->rpc_status) { | |||
1253 | rsp.op_ret = -1; | |||
1254 | rsp.op_errno = ENOTCONN107; | |||
1255 | goto out; | |||
1256 | } | |||
1257 | ||||
1258 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1259 | if (ret < 0) { | |||
1260 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1260 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1261 | rsp.op_ret = -1; | |||
1262 | rsp.op_errno = EINVAL22; | |||
1263 | goto out; | |||
1264 | } | |||
1265 | ||||
1266 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1268, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1268, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1267 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1268, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1268, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1268 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1268, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1268, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1269 | ||||
1270 | out: | |||
1271 | if (rsp.op_ret == -1) { | |||
1272 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1273, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1273 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1273, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1274 | } | |||
1275 | CLIENT_STACK_UNWIND (fremovexattr, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1276, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fremovexattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root->stack_lock); { _parent->ref_count --; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1276 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1276, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fremovexattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root->stack_lock); { _parent->ref_count --; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1277 | ||||
1278 | free (rsp.xdata.xdata_val); | |||
1279 | ||||
1280 | if (xdata) | |||
1281 | dict_unref (xdata); | |||
1282 | ||||
1283 | return 0; | |||
1284 | } | |||
1285 | ||||
1286 | int | |||
1287 | client3_3_fsyncdir_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1288 | void *myframe) | |||
1289 | { | |||
1290 | call_frame_t *frame = NULL((void*)0); | |||
1291 | gf_common_rsp rsp = {0,}; | |||
1292 | int ret = 0; | |||
1293 | xlator_t *this = NULL((void*)0); | |||
1294 | dict_t *xdata = NULL((void*)0); | |||
1295 | ||||
1296 | ||||
1297 | this = THIS(*__glusterfs_this_location()); | |||
1298 | ||||
1299 | frame = myframe; | |||
1300 | ||||
1301 | if (-1 == req->rpc_status) { | |||
1302 | rsp.op_ret = -1; | |||
1303 | rsp.op_errno = ENOTCONN107; | |||
1304 | goto out; | |||
1305 | } | |||
1306 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1307 | if (ret < 0) { | |||
1308 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1308 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1309 | rsp.op_ret = -1; | |||
1310 | rsp.op_errno = EINVAL22; | |||
1311 | goto out; | |||
1312 | } | |||
1313 | ||||
1314 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1316, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1316, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1315 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1316, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1316, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1316 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1316, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1316, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1317 | ||||
1318 | out: | |||
1319 | if (rsp.op_ret == -1) { | |||
1320 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1321, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1321 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1321, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1322 | } | |||
1323 | CLIENT_STACK_UNWIND (fsyncdir, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsyncdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1324, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsyncdir_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1324 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsyncdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1324, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsyncdir_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1325 | ||||
1326 | free (rsp.xdata.xdata_val); | |||
1327 | ||||
1328 | if (xdata) | |||
1329 | dict_unref (xdata); | |||
1330 | ||||
1331 | return 0; | |||
1332 | } | |||
1333 | ||||
1334 | int | |||
1335 | client3_3_access_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1336 | void *myframe) | |||
1337 | { | |||
1338 | call_frame_t *frame = NULL((void*)0); | |||
1339 | gf_common_rsp rsp = {0,}; | |||
1340 | int ret = 0; | |||
1341 | xlator_t *this = NULL((void*)0); | |||
1342 | dict_t *xdata = NULL((void*)0); | |||
1343 | ||||
1344 | ||||
1345 | this = THIS(*__glusterfs_this_location()); | |||
1346 | ||||
1347 | frame = myframe; | |||
1348 | ||||
1349 | if (-1 == req->rpc_status) { | |||
1350 | rsp.op_ret = -1; | |||
1351 | rsp.op_errno = ENOTCONN107; | |||
1352 | goto out; | |||
1353 | } | |||
1354 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1355 | if (ret < 0) { | |||
1356 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1356 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1357 | rsp.op_ret = -1; | |||
1358 | rsp.op_errno = EINVAL22; | |||
1359 | goto out; | |||
1360 | } | |||
1361 | ||||
1362 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1364, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1364, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1363 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1364, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1364, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1364 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1364, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1364, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1365 | ||||
1366 | out: | |||
1367 | if (rsp.op_ret == -1) { | |||
1368 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1369, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1369 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1369, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1370 | } | |||
1371 | CLIENT_STACK_UNWIND (access, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_access_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1372, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_access_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1372 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_access_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1372, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_access_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1373 | ||||
1374 | free (rsp.xdata.xdata_val); | |||
1375 | ||||
1376 | if (xdata) | |||
1377 | dict_unref (xdata); | |||
1378 | ||||
1379 | return 0; | |||
1380 | } | |||
1381 | ||||
1382 | ||||
1383 | int | |||
1384 | client3_3_ftruncate_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1385 | void *myframe) | |||
1386 | { | |||
1387 | gfs3_ftruncate_rsp rsp = {0,}; | |||
1388 | call_frame_t *frame = NULL((void*)0); | |||
1389 | struct iatt prestat = {0,}; | |||
1390 | struct iatt poststat = {0,}; | |||
1391 | int ret = 0; | |||
1392 | xlator_t *this = NULL((void*)0); | |||
1393 | dict_t *xdata = NULL((void*)0); | |||
1394 | ||||
1395 | ||||
1396 | this = THIS(*__glusterfs_this_location()); | |||
1397 | ||||
1398 | frame = myframe; | |||
1399 | ||||
1400 | if (-1 == req->rpc_status) { | |||
1401 | rsp.op_ret = -1; | |||
1402 | rsp.op_errno = ENOTCONN107; | |||
1403 | goto out; | |||
1404 | } | |||
1405 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_ftruncate_rsp); | |||
1406 | if (ret < 0) { | |||
1407 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1407 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1408 | rsp.op_ret = -1; | |||
1409 | rsp.op_errno = EINVAL22; | |||
1410 | goto out; | |||
1411 | } | |||
1412 | ||||
1413 | if (-1 != rsp.op_ret) { | |||
1414 | gf_stat_to_iatt (&rsp.prestat, &prestat); | |||
1415 | gf_stat_to_iatt (&rsp.poststat, &poststat); | |||
1416 | } | |||
1417 | ||||
1418 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1420, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1420, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1419 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1420, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1420, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1420 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1420, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1420, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1421 | ||||
1422 | out: | |||
1423 | if (rsp.op_ret == -1) { | |||
1424 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1425, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1425 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1425, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1426 | } | |||
1427 | CLIENT_STACK_UNWIND (ftruncate, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1429, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1428 | gf_error_to_errno (rsp.op_errno), &prestat,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1429, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1429 | &poststat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1429, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1430 | ||||
1431 | free (rsp.xdata.xdata_val); | |||
1432 | ||||
1433 | if (xdata) | |||
1434 | dict_unref (xdata); | |||
1435 | ||||
1436 | return 0; | |||
1437 | } | |||
1438 | ||||
1439 | int | |||
1440 | client3_3_fstat_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1441 | void *myframe) | |||
1442 | { | |||
1443 | gfs3_fstat_rsp rsp = {0,}; | |||
1444 | call_frame_t *frame = NULL((void*)0); | |||
1445 | struct iatt stat = {0,}; | |||
1446 | int ret = 0; | |||
1447 | xlator_t *this = NULL((void*)0); | |||
1448 | dict_t *xdata = NULL((void*)0); | |||
1449 | ||||
1450 | ||||
1451 | this = THIS(*__glusterfs_this_location()); | |||
1452 | ||||
1453 | frame = myframe; | |||
1454 | ||||
1455 | if (-1 == req->rpc_status) { | |||
1456 | rsp.op_ret = -1; | |||
1457 | rsp.op_errno = ENOTCONN107; | |||
1458 | goto out; | |||
1459 | } | |||
1460 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fstat_rsp); | |||
1461 | if (ret < 0) { | |||
1462 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1462 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1463 | rsp.op_ret = -1; | |||
1464 | rsp.op_errno = EINVAL22; | |||
1465 | goto out; | |||
1466 | } | |||
1467 | ||||
1468 | if (-1 != rsp.op_ret) { | |||
1469 | gf_stat_to_iatt (&rsp.stat, &stat); | |||
1470 | } | |||
1471 | ||||
1472 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1474, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1474, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1473 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1474, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1474, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1474 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1474, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1474, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1475 | ||||
1476 | out: | |||
1477 | if (rsp.op_ret == -1) { | |||
1478 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1479, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1479 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1479, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1480 | } | |||
1481 | CLIENT_STACK_UNWIND (fstat, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fstat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1482, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fstat_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &stat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1482 | gf_error_to_errno (rsp.op_errno), &stat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fstat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1482, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fstat_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &stat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1483 | ||||
1484 | free (rsp.xdata.xdata_val); | |||
1485 | ||||
1486 | if (xdata) | |||
1487 | dict_unref (xdata); | |||
1488 | ||||
1489 | return 0; | |||
1490 | } | |||
1491 | ||||
1492 | ||||
1493 | int | |||
1494 | client3_3_inodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1495 | void *myframe) | |||
1496 | { | |||
1497 | call_frame_t *frame = NULL((void*)0); | |||
1498 | gf_common_rsp rsp = {0,}; | |||
1499 | int ret = 0; | |||
1500 | xlator_t *this = NULL((void*)0); | |||
1501 | dict_t *xdata = NULL((void*)0); | |||
1502 | ||||
1503 | ||||
1504 | this = THIS(*__glusterfs_this_location()); | |||
1505 | ||||
1506 | frame = myframe; | |||
1507 | ||||
1508 | if (-1 == req->rpc_status) { | |||
1509 | rsp.op_ret = -1; | |||
1510 | rsp.op_errno = ENOTCONN107; | |||
1511 | goto out; | |||
1512 | } | |||
1513 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1514 | if (ret < 0) { | |||
1515 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1515 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1516 | rsp.op_ret = -1; | |||
1517 | rsp.op_errno = EINVAL22; | |||
1518 | goto out; | |||
1519 | } | |||
1520 | ||||
1521 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1523, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1523, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1522 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1523, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1523, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1523 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1523, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1523, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1524 | ||||
1525 | out: | |||
1526 | if ((rsp.op_ret == -1) && | |||
1527 | (EAGAIN11 != gf_error_to_errno (rsp.op_errno))) { | |||
1528 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1529, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1529 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1529, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1530 | } | |||
1531 | CLIENT_STACK_UNWIND (inodelk, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_inodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1532, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_inodelk_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1532 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_inodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1532, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_inodelk_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1533 | ||||
1534 | free (rsp.xdata.xdata_val); | |||
1535 | ||||
1536 | if (xdata) | |||
1537 | dict_unref (xdata); | |||
1538 | ||||
1539 | return 0; | |||
1540 | } | |||
1541 | ||||
1542 | int | |||
1543 | client3_3_finodelk_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1544 | void *myframe) | |||
1545 | { | |||
1546 | call_frame_t *frame = NULL((void*)0); | |||
1547 | gf_common_rsp rsp = {0,}; | |||
1548 | int ret = 0; | |||
1549 | xlator_t *this = NULL((void*)0); | |||
1550 | dict_t *xdata = NULL((void*)0); | |||
1551 | clnt_local_t *local = NULL((void*)0); | |||
1552 | ||||
1553 | ||||
1554 | frame = myframe; | |||
1555 | this = frame->this; | |||
1556 | local = frame->local; | |||
1557 | ||||
1558 | if (-1 == req->rpc_status) { | |||
1559 | rsp.op_ret = -1; | |||
1560 | rsp.op_errno = ENOTCONN107; | |||
1561 | goto out; | |||
1562 | } | |||
1563 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1564 | if (ret < 0) { | |||
1565 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1565 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1566 | rsp.op_ret = -1; | |||
1567 | rsp.op_errno = EINVAL22; | |||
1568 | goto out; | |||
1569 | } | |||
1570 | ||||
1571 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1573, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1573, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1572 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1573, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1573, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1573 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1573, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1573, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1574 | ||||
1575 | out: | |||
1576 | if ((rsp.op_ret == -1) && | |||
1577 | (EAGAIN11 != gf_error_to_errno (rsp.op_errno))) { | |||
1578 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1579, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1579 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1579, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1580 | } else if (rsp.op_ret == 0) { | |||
1581 | if (local->attempt_reopen) | |||
1582 | client_attempt_reopen (local->fd, this); | |||
1583 | } | |||
1584 | CLIENT_STACK_UNWIND (finodelk, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_finodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1585, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_finodelk_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1585 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_finodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1585, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_finodelk_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1586 | ||||
1587 | free (rsp.xdata.xdata_val); | |||
1588 | ||||
1589 | if (xdata) | |||
1590 | dict_unref (xdata); | |||
1591 | ||||
1592 | return 0; | |||
1593 | } | |||
1594 | ||||
1595 | int | |||
1596 | client3_3_entrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1597 | void *myframe) | |||
1598 | { | |||
1599 | call_frame_t *frame = NULL((void*)0); | |||
1600 | gf_common_rsp rsp = {0,}; | |||
1601 | int ret = 0; | |||
1602 | xlator_t *this = NULL((void*)0); | |||
1603 | dict_t *xdata = NULL((void*)0); | |||
1604 | ||||
1605 | ||||
1606 | this = THIS(*__glusterfs_this_location()); | |||
1607 | ||||
1608 | frame = myframe; | |||
1609 | ||||
1610 | if (-1 == req->rpc_status) { | |||
1611 | rsp.op_ret = -1; | |||
1612 | rsp.op_errno = ENOTCONN107; | |||
1613 | goto out; | |||
1614 | } | |||
1615 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1616 | if (ret < 0) { | |||
1617 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1617 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1618 | rsp.op_ret = -1; | |||
1619 | rsp.op_errno = EINVAL22; | |||
1620 | goto out; | |||
1621 | } | |||
1622 | ||||
1623 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1625, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1625, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1624 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1625, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1625, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1625 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1625, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1625, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1626 | ||||
1627 | out: | |||
1628 | if ((rsp.op_ret == -1) && | |||
1629 | (EAGAIN11 != gf_error_to_errno (rsp.op_errno))) { | |||
1630 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1631, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1631 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1631, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1632 | } | |||
1633 | ||||
1634 | CLIENT_STACK_UNWIND (entrylk, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_entrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1635, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_entrylk_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1635 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_entrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1635, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_entrylk_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1636 | ||||
1637 | free (rsp.xdata.xdata_val); | |||
1638 | ||||
1639 | if (xdata) | |||
1640 | dict_unref (xdata); | |||
1641 | ||||
1642 | return 0; | |||
1643 | } | |||
1644 | ||||
1645 | int | |||
1646 | client3_3_fentrylk_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1647 | void *myframe) | |||
1648 | { | |||
1649 | call_frame_t *frame = NULL((void*)0); | |||
1650 | gf_common_rsp rsp = {0,}; | |||
1651 | int ret = 0; | |||
1652 | xlator_t *this = NULL((void*)0); | |||
1653 | dict_t *xdata = NULL((void*)0); | |||
1654 | ||||
1655 | ||||
1656 | this = THIS(*__glusterfs_this_location()); | |||
1657 | ||||
1658 | frame = myframe; | |||
1659 | ||||
1660 | if (-1 == req->rpc_status) { | |||
1661 | rsp.op_ret = -1; | |||
1662 | rsp.op_errno = ENOTCONN107; | |||
1663 | goto out; | |||
1664 | } | |||
1665 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1666 | if (ret < 0) { | |||
1667 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1667 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1668 | rsp.op_ret = -1; | |||
1669 | rsp.op_errno = EINVAL22; | |||
1670 | goto out; | |||
1671 | } | |||
1672 | ||||
1673 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1675, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1675, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1674 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1675, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1675, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1675 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1675, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1675, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1676 | ||||
1677 | out: | |||
1678 | if ((rsp.op_ret == -1) && | |||
1679 | (EAGAIN11 != gf_error_to_errno (rsp.op_errno))) { | |||
1680 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1681, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1681 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1681, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1682 | } | |||
1683 | ||||
1684 | CLIENT_STACK_UNWIND (fentrylk, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fentrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1685, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fentrylk_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1685 | gf_error_to_errno (rsp.op_errno), xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fentrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1685, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fentrylk_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1686 | ||||
1687 | free (rsp.xdata.xdata_val); | |||
1688 | ||||
1689 | if (xdata) | |||
1690 | dict_unref (xdata); | |||
1691 | ||||
1692 | return 0; | |||
1693 | } | |||
1694 | ||||
1695 | int | |||
1696 | client3_3_xattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1697 | void *myframe) | |||
1698 | { | |||
1699 | call_frame_t *frame = NULL((void*)0); | |||
1700 | dict_t *dict = NULL((void*)0); | |||
1701 | gfs3_xattrop_rsp rsp = {0,}; | |||
1702 | int ret = 0; | |||
1703 | int op_errno = EINVAL22; | |||
1704 | clnt_local_t *local = NULL((void*)0); | |||
1705 | xlator_t *this = NULL((void*)0); | |||
1706 | dict_t *xdata = NULL((void*)0); | |||
1707 | ||||
1708 | ||||
1709 | this = THIS(*__glusterfs_this_location()); | |||
1710 | ||||
1711 | frame = myframe; | |||
1712 | local = frame->local; | |||
1713 | ||||
1714 | if (-1 == req->rpc_status) { | |||
1715 | rsp.op_ret = -1; | |||
1716 | op_errno = ENOTCONN107; | |||
1717 | goto out; | |||
1718 | } | |||
1719 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_xattrop_rsp); | |||
1720 | if (ret < 0) { | |||
1721 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1721 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1722 | rsp.op_ret = -1; | |||
1723 | op_errno = EINVAL22; | |||
1724 | goto out; | |||
1725 | } | |||
1726 | ||||
1727 | op_errno = rsp.op_errno; | |||
1728 | if (-1 != rsp.op_ret) { | |||
1729 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, dict,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1732, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1732, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1730 | (rsp.dict.dict_val),do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1732, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1732, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1731 | (rsp.dict.dict_len), rsp.op_ret,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1732, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1732, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1732 | op_errno, out)do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1732, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1732, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0); | |||
1733 | } | |||
1734 | ||||
1735 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1737, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1737, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1736 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1737, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1737, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1737 | op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1737, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1737, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0); | |||
1738 | ||||
1739 | out: | |||
1740 | if (rsp.op_ret == -1) { | |||
1741 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1744, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
1742 | "remote operation failed: %s. Path: %s (%s)",do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1744, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
1743 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1744, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
1744 | local->loc.path, loc_gfid_utoa (&local->loc))do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1744, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0); | |||
1745 | } | |||
1746 | ||||
1747 | CLIENT_STACK_UNWIND (xattrop, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_xattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1748, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_xattrop_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (op_errno), dict, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1748 | gf_error_to_errno (op_errno), dict, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_xattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1748, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_xattrop_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (op_errno), dict, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1749 | ||||
1750 | free (rsp.dict.dict_val); | |||
1751 | ||||
1752 | free (rsp.xdata.xdata_val); | |||
1753 | ||||
1754 | if (xdata) | |||
1755 | dict_unref (xdata); | |||
1756 | ||||
1757 | if (dict) | |||
1758 | dict_unref (dict); | |||
1759 | ||||
1760 | return 0; | |||
1761 | } | |||
1762 | ||||
1763 | int | |||
1764 | client3_3_fxattrop_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1765 | void *myframe) | |||
1766 | { | |||
1767 | call_frame_t *frame = NULL((void*)0); | |||
1768 | dict_t *dict = NULL((void*)0); | |||
1769 | dict_t *xdata = NULL((void*)0); | |||
1770 | gfs3_fxattrop_rsp rsp = {0,}; | |||
1771 | int ret = 0; | |||
1772 | int op_errno = 0; | |||
1773 | clnt_local_t *local = NULL((void*)0); | |||
1774 | xlator_t *this = NULL((void*)0); | |||
1775 | ||||
1776 | this = THIS(*__glusterfs_this_location()); | |||
1777 | ||||
1778 | frame = myframe; | |||
1779 | local = frame->local; | |||
1780 | ||||
1781 | if (-1 == req->rpc_status) { | |||
1782 | rsp.op_ret = -1; | |||
1783 | op_errno = ENOTCONN107; | |||
1784 | goto out; | |||
1785 | } | |||
1786 | ||||
1787 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fxattrop_rsp); | |||
1788 | if (ret < 0) { | |||
1789 | rsp.op_ret = -1; | |||
1790 | op_errno = EINVAL22; | |||
1791 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1791 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1792 | goto out; | |||
1793 | } | |||
1794 | op_errno = rsp.op_errno; | |||
1795 | if (-1 != rsp.op_ret) { | |||
1796 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, dict,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1799, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1799, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1797 | (rsp.dict.dict_val),do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1799, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1799, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1798 | (rsp.dict.dict_len), rsp.op_ret,do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1799, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1799, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0) | |||
1799 | op_errno, out)do { if (!(rsp.dict.dict_len)) break; dict = dict_new(); do { if (!dict) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "dict"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1799, GF_LOG_ERROR, "invalid argument: " "dict"); } while (0 ); goto out; } } while (0); rsp.op_ret = dict_unserialize ((rsp .dict.dict_val), (rsp.dict.dict_len), &dict); if (rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("dict")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1799, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("dict")); } while (0); op_errno = 22; goto out; } } while ( 0); | |||
1800 | } | |||
1801 | ||||
1802 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1805, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1805, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1803 | (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1805, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1805, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1804 | (rsp.xdata.xdata_len), rsp.op_ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1805, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1805, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
1805 | op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 1805, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 1805, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0); | |||
1806 | out: | |||
1807 | ||||
1808 | if (rsp.op_ret == -1) { | |||
1809 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (op_errno))); } while (0); _gf_log (this-> name, "client-rpc-fops.c", __FUNCTION__, 1811, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( op_errno))); } while (0) | |||
1810 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (op_errno))); } while (0); _gf_log (this-> name, "client-rpc-fops.c", __FUNCTION__, 1811, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( op_errno))); } while (0) | |||
1811 | strerror (gf_error_to_errno (op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (op_errno))); } while (0); _gf_log (this-> name, "client-rpc-fops.c", __FUNCTION__, 1811, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( op_errno))); } while (0); | |||
1812 | } else if (rsp.op_ret == 0) { | |||
1813 | if (local->attempt_reopen) | |||
1814 | client_attempt_reopen (local->fd, this); | |||
1815 | } | |||
1816 | CLIENT_STACK_UNWIND (fxattrop, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fxattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1817, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fxattrop_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (op_errno), dict, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1817 | gf_error_to_errno (op_errno), dict, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fxattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1817, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fxattrop_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (op_errno), dict, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1818 | ||||
1819 | free (rsp.dict.dict_val); | |||
1820 | ||||
1821 | free (rsp.xdata.xdata_val); | |||
1822 | ||||
1823 | if (xdata) | |||
1824 | dict_unref (xdata); | |||
1825 | ||||
1826 | if (dict) | |||
1827 | dict_unref (dict); | |||
1828 | ||||
1829 | return 0; | |||
1830 | } | |||
1831 | ||||
1832 | int | |||
1833 | client3_3_fsetxattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1834 | void *myframe) | |||
1835 | { | |||
1836 | call_frame_t *frame = NULL((void*)0); | |||
1837 | gf_common_rsp rsp = {0,}; | |||
1838 | int ret = 0; | |||
1839 | xlator_t *this = NULL((void*)0); | |||
1840 | dict_t *xdata = NULL((void*)0); | |||
1841 | int op_errno = EINVAL22; | |||
1842 | ||||
1843 | this = THIS(*__glusterfs_this_location()); | |||
1844 | ||||
1845 | frame = myframe; | |||
1846 | ||||
1847 | if (-1 == req->rpc_status) { | |||
1848 | rsp.op_ret = -1; | |||
1849 | rsp.op_errno = ENOTCONN107; | |||
1850 | goto out; | |||
1851 | } | |||
1852 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_common_rsp); | |||
1853 | if (ret < 0) { | |||
1854 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1854 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1855 | rsp.op_ret = -1; | |||
1856 | rsp.op_errno = EINVAL22; | |||
1857 | goto out; | |||
1858 | } | |||
1859 | ||||
1860 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1862, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1862, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1861 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1862, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1862, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1862 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1862, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1862, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1863 | ||||
1864 | out: | |||
1865 | op_errno = gf_error_to_errno (rsp.op_errno); | |||
1866 | if (rsp.op_ret == -1) { | |||
1867 | gf_log (this->name, ((op_errno == ENOTSUP) ?do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1870, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1868 | GF_LOG_DEBUG : GF_LOG_WARNING),do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1870, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1869 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1870, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0) | |||
1870 | strerror (op_errno))do { do { if (0) printf ("remote operation failed: %s", strerror (op_errno)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 1870, ((op_errno == 95) ? GF_LOG_DEBUG : GF_LOG_WARNING ), "remote operation failed: %s", strerror (op_errno)); } while (0); | |||
1871 | } | |||
1872 | ||||
1873 | CLIENT_STACK_UNWIND (fsetxattr, frame, rsp.op_ret, op_errno, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1873, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsetxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, op_errno, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1874 | ||||
1875 | free (rsp.xdata.xdata_val); | |||
1876 | ||||
1877 | if (xdata) | |||
1878 | dict_unref (xdata); | |||
1879 | ||||
1880 | return 0; | |||
1881 | } | |||
1882 | ||||
1883 | int | |||
1884 | client3_3_fsetattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1885 | void *myframe) | |||
1886 | { | |||
1887 | call_frame_t *frame = NULL((void*)0); | |||
1888 | gfs3_fsetattr_rsp rsp = {0,}; | |||
1889 | struct iatt prestat = {0,}; | |||
1890 | struct iatt poststat = {0,}; | |||
1891 | int ret = 0; | |||
1892 | xlator_t *this = NULL((void*)0); | |||
1893 | dict_t *xdata = NULL((void*)0); | |||
1894 | ||||
1895 | ||||
1896 | this = THIS(*__glusterfs_this_location()); | |||
1897 | ||||
1898 | frame = myframe; | |||
1899 | ||||
1900 | if (-1 == req->rpc_status) { | |||
1901 | rsp.op_ret = -1; | |||
1902 | rsp.op_errno = ENOTCONN107; | |||
1903 | goto out; | |||
1904 | } | |||
1905 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_fsetattr_rsp); | |||
1906 | if (ret < 0) { | |||
1907 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1907 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1908 | rsp.op_ret = -1; | |||
1909 | rsp.op_errno = EINVAL22; | |||
1910 | goto out; | |||
1911 | } | |||
1912 | ||||
1913 | if (-1 != rsp.op_ret) { | |||
1914 | gf_stat_to_iatt (&rsp.statpre, &prestat); | |||
1915 | gf_stat_to_iatt (&rsp.statpost, &poststat); | |||
1916 | } | |||
1917 | ||||
1918 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1920, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1920, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1919 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1920, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1920, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1920 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1920, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1920, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1921 | ||||
1922 | out: | |||
1923 | if (rsp.op_ret == -1) { | |||
1924 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1925, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1925 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1925, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1926 | } | |||
1927 | CLIENT_STACK_UNWIND (fsetattr, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1929, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1928 | gf_error_to_errno (rsp.op_errno), &prestat,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1929, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1929 | &poststat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1929, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & prestat, &poststat, xdata); (*__glusterfs_this_location() ) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1930 | ||||
1931 | free (rsp.xdata.xdata_val); | |||
1932 | ||||
1933 | if (xdata) | |||
1934 | dict_unref (xdata); | |||
1935 | ||||
1936 | return 0; | |||
1937 | } | |||
1938 | ||||
1939 | ||||
1940 | int | |||
1941 | client3_3_setattr_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1942 | void *myframe) | |||
1943 | { | |||
1944 | call_frame_t *frame = NULL((void*)0); | |||
1945 | gfs3_setattr_rsp rsp = {0,}; | |||
1946 | struct iatt prestat = {0,}; | |||
1947 | struct iatt poststat = {0,}; | |||
1948 | int ret = 0; | |||
1949 | xlator_t *this = NULL((void*)0); | |||
1950 | dict_t *xdata = NULL((void*)0); | |||
1951 | ||||
1952 | ||||
1953 | this = THIS(*__glusterfs_this_location()); | |||
1954 | ||||
1955 | frame = myframe; | |||
1956 | ||||
1957 | if (-1 == req->rpc_status) { | |||
1958 | rsp.op_ret = -1; | |||
1959 | rsp.op_errno = ENOTCONN107; | |||
1960 | goto out; | |||
1961 | } | |||
1962 | ||||
1963 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_setattr_rsp); | |||
1964 | if (ret < 0) { | |||
1965 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 1965 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
1966 | rsp.op_ret = -1; | |||
1967 | rsp.op_errno = EINVAL22; | |||
1968 | goto out; | |||
1969 | } | |||
1970 | ||||
1971 | if (-1 != rsp.op_ret) { | |||
1972 | gf_stat_to_iatt (&rsp.statpre, &prestat); | |||
1973 | gf_stat_to_iatt (&rsp.statpost, &poststat); | |||
1974 | } | |||
1975 | ||||
1976 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1978, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1977 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1978, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
1978 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 1978, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 1978, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
1979 | ||||
1980 | out: | |||
1981 | if (rsp.op_ret == -1) { | |||
1982 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1983, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
1983 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 1983, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
1984 | } | |||
1985 | CLIENT_STACK_UNWIND (setattr, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1987, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1986 | gf_error_to_errno (rsp.op_errno), &prestat,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1987, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
1987 | &poststat, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 1987, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &prestat, & poststat, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
1988 | ||||
1989 | free (rsp.xdata.xdata_val); | |||
1990 | ||||
1991 | if (xdata) | |||
1992 | dict_unref (xdata); | |||
1993 | ||||
1994 | return 0; | |||
1995 | } | |||
1996 | ||||
1997 | int | |||
1998 | client3_3_create_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
1999 | void *myframe) | |||
2000 | { | |||
2001 | call_frame_t *frame = NULL((void*)0); | |||
2002 | fd_t *fd = NULL((void*)0); | |||
2003 | inode_t *inode = NULL((void*)0); | |||
2004 | struct iatt stbuf = {0, }; | |||
2005 | struct iatt preparent = {0, }; | |||
2006 | struct iatt postparent = {0, }; | |||
2007 | int32_t ret = -1; | |||
2008 | clnt_local_t *local = NULL((void*)0); | |||
2009 | gfs3_create_rsp rsp = {0,}; | |||
2010 | xlator_t *this = NULL((void*)0); | |||
2011 | dict_t *xdata = NULL((void*)0); | |||
2012 | ||||
2013 | this = THIS(*__glusterfs_this_location()); | |||
2014 | ||||
2015 | frame = myframe; | |||
2016 | local = frame->local; | |||
2017 | fd = local->fd; | |||
2018 | inode = local->loc.inode; | |||
2019 | ||||
2020 | if (-1 == req->rpc_status) { | |||
2021 | rsp.op_ret = -1; | |||
2022 | rsp.op_errno = ENOTCONN107; | |||
2023 | goto out; | |||
2024 | } | |||
2025 | ||||
2026 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_create_rsp); | |||
2027 | if (ret < 0) { | |||
2028 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2028 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2029 | rsp.op_ret = -1; | |||
2030 | rsp.op_errno = EINVAL22; | |||
2031 | goto out; | |||
2032 | } | |||
2033 | ||||
2034 | if (-1 != rsp.op_ret) { | |||
2035 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
2036 | ||||
2037 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
2038 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
2039 | uuid_copy (local->loc.gfid, stbuf.ia_gfid); | |||
2040 | ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc, | |||
2041 | local->flags, rsp.fd, 0); | |||
2042 | if (ret) { | |||
2043 | rsp.op_ret = -1; | |||
2044 | rsp.op_errno = -ret; | |||
2045 | goto out; | |||
2046 | } | |||
2047 | } | |||
2048 | ||||
2049 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2051, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2051, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2050 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2051, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2051, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2051 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2051, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2051, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2052 | ||||
2053 | out: | |||
2054 | if (rsp.op_ret == -1) { | |||
2055 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2058, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
2056 | "remote operation failed: %s. Path: %s",do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2058, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
2057 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2058, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0) | |||
2058 | local->loc.path)do { do { if (0) printf ("remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2058, GF_LOG_WARNING, "remote operation failed: %s. Path: %s" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path); } while (0); | |||
2059 | } | |||
2060 | ||||
2061 | CLIENT_STACK_UNWIND (create, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2063, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, inode, &stbuf , &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2062 | gf_error_to_errno (rsp.op_errno), fd, inode,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2063, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, inode, &stbuf , &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2063 | &stbuf, &preparent, &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2063, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, inode, &stbuf , &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2064 | ||||
2065 | free (rsp.xdata.xdata_val); | |||
2066 | ||||
2067 | if (xdata) | |||
2068 | dict_unref (xdata); | |||
2069 | ||||
2070 | return 0; | |||
2071 | } | |||
2072 | ||||
2073 | ||||
2074 | int | |||
2075 | client3_3_rchecksum_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2076 | void *myframe) | |||
2077 | { | |||
2078 | call_frame_t *frame = NULL((void*)0); | |||
2079 | gfs3_rchecksum_rsp rsp = {0,}; | |||
2080 | int ret = 0; | |||
2081 | xlator_t *this = NULL((void*)0); | |||
2082 | dict_t *xdata = NULL((void*)0); | |||
2083 | ||||
2084 | ||||
2085 | this = THIS(*__glusterfs_this_location()); | |||
2086 | ||||
2087 | frame = myframe; | |||
2088 | ||||
2089 | if (-1 == req->rpc_status) { | |||
2090 | rsp.op_ret = -1; | |||
2091 | rsp.op_errno = ENOTCONN107; | |||
2092 | goto out; | |||
2093 | } | |||
2094 | ||||
2095 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rchecksum_rsp); | |||
2096 | if (ret < 0) { | |||
2097 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2097 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2098 | rsp.op_ret = -1; | |||
2099 | rsp.op_errno = EINVAL22; | |||
2100 | goto out; | |||
2101 | } | |||
2102 | ||||
2103 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2105, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2105, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2104 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2105, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2105, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2105 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2105, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2105, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2106 | ||||
2107 | out: | |||
2108 | if (rsp.op_ret == -1) { | |||
2109 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2110, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2110 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2110, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
2111 | } | |||
2112 | CLIENT_STACK_UNWIND (rchecksum, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rchecksum_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2116, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rchecksum_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. weak_checksum, (uint8_t *)rsp.strong_checksum.strong_checksum_val , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); client_local_wipe (__local); } while (0) | |||
2113 | gf_error_to_errno (rsp.op_errno),do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rchecksum_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2116, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rchecksum_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. weak_checksum, (uint8_t *)rsp.strong_checksum.strong_checksum_val , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); client_local_wipe (__local); } while (0) | |||
2114 | rsp.weak_checksum,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rchecksum_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2116, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rchecksum_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. weak_checksum, (uint8_t *)rsp.strong_checksum.strong_checksum_val , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); client_local_wipe (__local); } while (0) | |||
2115 | (uint8_t *)rsp.strong_checksum.strong_checksum_val,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rchecksum_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2116, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rchecksum_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. weak_checksum, (uint8_t *)rsp.strong_checksum.strong_checksum_val , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); client_local_wipe (__local); } while (0) | |||
2116 | xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rchecksum_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2116, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rchecksum_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), rsp. weak_checksum, (uint8_t *)rsp.strong_checksum.strong_checksum_val , xdata); (*__glusterfs_this_location()) = old_THIS; } while ( 0); client_local_wipe (__local); } while (0); | |||
2117 | ||||
2118 | if (rsp.strong_checksum.strong_checksum_val) { | |||
2119 | /* This is allocated by the libc while decoding RPC msg */ | |||
2120 | /* Hence no 'GF_FREE', but just 'free' */ | |||
2121 | free (rsp.strong_checksum.strong_checksum_val); | |||
2122 | } | |||
2123 | ||||
2124 | free (rsp.xdata.xdata_val); | |||
2125 | ||||
2126 | if (xdata) | |||
2127 | dict_unref (xdata); | |||
2128 | ||||
2129 | return 0; | |||
2130 | } | |||
2131 | ||||
2132 | int | |||
2133 | client3_3_lk_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2134 | void *myframe) | |||
2135 | { | |||
2136 | call_frame_t *frame = NULL((void*)0); | |||
2137 | clnt_local_t *local = NULL((void*)0); | |||
2138 | struct gf_flock lock = {0,}; | |||
2139 | gfs3_lk_rsp rsp = {0,}; | |||
2140 | int ret = 0; | |||
2141 | xlator_t *this = NULL((void*)0); | |||
2142 | dict_t *xdata = NULL((void*)0); | |||
2143 | ||||
2144 | this = THIS(*__glusterfs_this_location()); | |||
2145 | ||||
2146 | frame = myframe; | |||
2147 | local = frame->local; | |||
2148 | ||||
2149 | if (-1 == req->rpc_status) { | |||
2150 | rsp.op_ret = -1; | |||
2151 | rsp.op_errno = ENOTCONN107; | |||
2152 | goto out; | |||
2153 | } | |||
2154 | ||||
2155 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lk_rsp); | |||
2156 | if (ret < 0) { | |||
2157 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2157 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2158 | rsp.op_ret = -1; | |||
2159 | rsp.op_errno = EINVAL22; | |||
2160 | goto out; | |||
2161 | } | |||
2162 | ||||
2163 | if (rsp.op_ret >= 0) { | |||
2164 | gf_proto_flock_to_flock (&rsp.flock, &lock); | |||
2165 | } | |||
2166 | ||||
2167 | /* Save the lock to the client lock cache to be able | |||
2168 | to recover in the case of server reboot.*/ | |||
2169 | /* | |||
2170 | temporarily | |||
2171 | if (local->cmd == F_SETLK || local->cmd == F_SETLKW) { | |||
2172 | ret = client_add_lock_for_recovery (local->fd, &lock, | |||
2173 | local->owner, local->cmd); | |||
2174 | if (ret < 0) { | |||
2175 | rsp.op_ret = -1; | |||
2176 | rsp.op_errno = -ret; | |||
2177 | } | |||
2178 | } | |||
2179 | */ | |||
2180 | ||||
2181 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2183, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2183, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2182 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2183, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2183, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2183 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2183, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2183, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2184 | ||||
2185 | out: | |||
2186 | if ((rsp.op_ret == -1) && | |||
2187 | (EAGAIN11 != gf_error_to_errno (rsp.op_errno))) { | |||
2188 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2190, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2189 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2190, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2190 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2190, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
2191 | } | |||
2192 | ||||
2193 | CLIENT_STACK_UNWIND (lk, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2194, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &lock, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2194 | gf_error_to_errno (rsp.op_errno), &lock, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2194, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &lock, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2195 | ||||
2196 | free (rsp.xdata.xdata_val); | |||
2197 | ||||
2198 | free (rsp.flock.lk_owner.lk_owner_val); | |||
2199 | ||||
2200 | if (xdata) | |||
2201 | dict_unref (xdata); | |||
2202 | ||||
2203 | return 0; | |||
2204 | } | |||
2205 | ||||
2206 | int | |||
2207 | client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2208 | void *myframe) | |||
2209 | { | |||
2210 | call_frame_t *frame = NULL((void*)0); | |||
2211 | gfs3_readdir_rsp rsp = {0,}; | |||
2212 | int32_t ret = 0; | |||
2213 | clnt_local_t *local = NULL((void*)0); | |||
2214 | gf_dirent_t entries; | |||
2215 | xlator_t *this = NULL((void*)0); | |||
2216 | dict_t *xdata = NULL((void*)0); | |||
2217 | ||||
2218 | this = THIS(*__glusterfs_this_location()); | |||
2219 | ||||
2220 | frame = myframe; | |||
2221 | local = frame->local; | |||
2222 | ||||
2223 | if (-1 == req->rpc_status) { | |||
2224 | rsp.op_ret = -1; | |||
2225 | rsp.op_errno = ENOTCONN107; | |||
2226 | goto out; | |||
2227 | } | |||
2228 | ||||
2229 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdir_rsp); | |||
2230 | if (ret < 0) { | |||
2231 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2231 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2232 | rsp.op_ret = -1; | |||
2233 | rsp.op_errno = EINVAL22; | |||
2234 | goto out; | |||
2235 | } | |||
2236 | ||||
2237 | INIT_LIST_HEAD (&entries.list)do { (&entries.list)->next = (&entries.list)->prev = &entries.list; } while (0); | |||
2238 | if (rsp.op_ret > 0) { | |||
2239 | unserialize_rsp_dirent (&rsp, &entries); | |||
2240 | } | |||
2241 | ||||
2242 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2245, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2245, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2243 | (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2245, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2245, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2244 | (rsp.xdata.xdata_len), rsp.op_ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2245, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2245, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2245 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2245, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2245, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2246 | ||||
2247 | out: | |||
2248 | if (rsp.op_ret == -1) { | |||
2249 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2252, GF_LOG_WARNING, "remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0) | |||
2250 | "remote operation failed: %s remote_fd = %d",do { do { if (0) printf ("remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2252, GF_LOG_WARNING, "remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0) | |||
2251 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2252, GF_LOG_WARNING, "remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0) | |||
2252 | local->cmd)do { do { if (0) printf ("remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2252, GF_LOG_WARNING, "remote operation failed: %s remote_fd = %d" , strerror (gf_error_to_errno (rsp.op_errno)), local->cmd) ; } while (0); | |||
2253 | } | |||
2254 | CLIENT_STACK_UNWIND (readdir, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2255, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &entries, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2255 | gf_error_to_errno (rsp.op_errno), &entries, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2255, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &entries, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2256 | ||||
2257 | if (rsp.op_ret != -1) { | |||
2258 | gf_dirent_free (&entries); | |||
2259 | } | |||
2260 | ||||
2261 | free (rsp.xdata.xdata_val); | |||
2262 | ||||
2263 | if (xdata) | |||
2264 | dict_unref (xdata); | |||
2265 | ||||
2266 | clnt_readdir_rsp_cleanup (&rsp); | |||
2267 | ||||
2268 | return 0; | |||
2269 | } | |||
2270 | ||||
2271 | ||||
2272 | int | |||
2273 | client3_3_readdirp_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2274 | void *myframe) | |||
2275 | { | |||
2276 | call_frame_t *frame = NULL((void*)0); | |||
2277 | gfs3_readdirp_rsp rsp = {0,}; | |||
2278 | int32_t ret = 0; | |||
2279 | clnt_local_t *local = NULL((void*)0); | |||
2280 | gf_dirent_t entries; | |||
2281 | xlator_t *this = NULL((void*)0); | |||
2282 | dict_t *xdata = NULL((void*)0); | |||
2283 | ||||
2284 | this = THIS(*__glusterfs_this_location()); | |||
2285 | ||||
2286 | frame = myframe; | |||
2287 | local = frame->local; | |||
2288 | ||||
2289 | if (-1 == req->rpc_status) { | |||
2290 | rsp.op_ret = -1; | |||
2291 | rsp.op_errno = ENOTCONN107; | |||
2292 | goto out; | |||
2293 | } | |||
2294 | ||||
2295 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_readdirp_rsp); | |||
2296 | if (ret < 0) { | |||
2297 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2297 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2298 | rsp.op_ret = -1; | |||
2299 | rsp.op_errno = EINVAL22; | |||
2300 | goto out; | |||
2301 | } | |||
2302 | ||||
2303 | INIT_LIST_HEAD (&entries.list)do { (&entries.list)->next = (&entries.list)->prev = &entries.list; } while (0); | |||
2304 | if (rsp.op_ret > 0) { | |||
2305 | unserialize_rsp_direntp (this, local->fd, &rsp, &entries); | |||
2306 | } | |||
2307 | ||||
2308 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2310, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2310, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2309 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2310, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2310, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2310 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2310, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2310, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2311 | ||||
2312 | out: | |||
2313 | if (rsp.op_ret == -1) { | |||
2314 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2316, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2315 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2316, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2316 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2316, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
2317 | } | |||
2318 | CLIENT_STACK_UNWIND (readdirp, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2319, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readdirp_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & entries, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2319 | gf_error_to_errno (rsp.op_errno), &entries, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2319, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readdirp_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, rsp.op_ret, gf_error_to_errno (rsp.op_errno), & entries, xdata); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2320 | ||||
2321 | if (rsp.op_ret != -1) { | |||
2322 | gf_dirent_free (&entries); | |||
2323 | } | |||
2324 | free (rsp.xdata.xdata_val); | |||
2325 | ||||
2326 | if (xdata) | |||
2327 | dict_unref (xdata); | |||
2328 | ||||
2329 | clnt_readdirp_rsp_cleanup (&rsp); | |||
2330 | ||||
2331 | return 0; | |||
2332 | } | |||
2333 | ||||
2334 | ||||
2335 | int | |||
2336 | client3_3_rename_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2337 | void *myframe) | |||
2338 | { | |||
2339 | call_frame_t *frame = NULL((void*)0); | |||
2340 | gfs3_rename_rsp rsp = {0,}; | |||
2341 | struct iatt stbuf = {0,}; | |||
2342 | struct iatt preoldparent = {0,}; | |||
2343 | struct iatt postoldparent = {0,}; | |||
2344 | struct iatt prenewparent = {0,}; | |||
2345 | struct iatt postnewparent = {0,}; | |||
2346 | int ret = 0; | |||
2347 | xlator_t *this = NULL((void*)0); | |||
2348 | dict_t *xdata = NULL((void*)0); | |||
2349 | ||||
2350 | this = THIS(*__glusterfs_this_location()); | |||
2351 | ||||
2352 | frame = myframe; | |||
2353 | ||||
2354 | if (-1 == req->rpc_status) { | |||
2355 | rsp.op_ret = -1; | |||
2356 | rsp.op_errno = ENOTCONN107; | |||
2357 | goto out; | |||
2358 | } | |||
2359 | ||||
2360 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_rename_rsp); | |||
2361 | if (ret < 0) { | |||
2362 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2362 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2363 | rsp.op_ret = -1; | |||
2364 | rsp.op_errno = EINVAL22; | |||
2365 | goto out; | |||
2366 | } | |||
2367 | ||||
2368 | if (-1 != rsp.op_ret) { | |||
2369 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
2370 | ||||
2371 | gf_stat_to_iatt (&rsp.preoldparent, &preoldparent); | |||
2372 | gf_stat_to_iatt (&rsp.postoldparent, &postoldparent); | |||
2373 | ||||
2374 | gf_stat_to_iatt (&rsp.prenewparent, &prenewparent); | |||
2375 | gf_stat_to_iatt (&rsp.postnewparent, &postnewparent); | |||
2376 | } | |||
2377 | ||||
2378 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2380, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2380, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2379 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2380, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2380, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2380 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2380, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2380, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2381 | ||||
2382 | out: | |||
2383 | if (rsp.op_ret == -1) { | |||
2384 | gf_log (this->name, GF_LOG_WARNING, "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2385, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2385 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2385, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
2386 | } | |||
2387 | CLIENT_STACK_UNWIND (rename, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2390, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &stbuf, &preoldparent , &postoldparent, &prenewparent, &postnewparent, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2388 | gf_error_to_errno (rsp.op_errno),do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2390, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &stbuf, &preoldparent , &postoldparent, &prenewparent, &postnewparent, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2389 | &stbuf, &preoldparent, &postoldparent,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2390, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &stbuf, &preoldparent , &postoldparent, &prenewparent, &postnewparent, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2390 | &prenewparent, &postnewparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2390, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), &stbuf, &preoldparent , &postoldparent, &prenewparent, &postnewparent, xdata ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2391 | ||||
2392 | free (rsp.xdata.xdata_val); | |||
2393 | ||||
2394 | if (xdata) | |||
2395 | dict_unref (xdata); | |||
2396 | ||||
2397 | return 0; | |||
2398 | } | |||
2399 | ||||
2400 | int | |||
2401 | client3_3_link_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2402 | void *myframe) | |||
2403 | { | |||
2404 | call_frame_t *frame = NULL((void*)0); | |||
2405 | gfs3_link_rsp rsp = {0,}; | |||
2406 | struct iatt stbuf = {0,}; | |||
2407 | struct iatt preparent = {0,}; | |||
2408 | struct iatt postparent = {0,}; | |||
2409 | int ret = 0; | |||
2410 | clnt_local_t *local = NULL((void*)0); | |||
2411 | inode_t *inode = NULL((void*)0); | |||
2412 | xlator_t *this = NULL((void*)0); | |||
2413 | dict_t *xdata = NULL((void*)0); | |||
2414 | ||||
2415 | ||||
2416 | this = THIS(*__glusterfs_this_location()); | |||
2417 | ||||
2418 | frame = myframe; | |||
2419 | ||||
2420 | local = frame->local; | |||
2421 | inode = local->loc.inode; | |||
2422 | ||||
2423 | if (-1 == req->rpc_status) { | |||
2424 | rsp.op_ret = -1; | |||
2425 | rsp.op_errno = ENOTCONN107; | |||
2426 | goto out; | |||
2427 | } | |||
2428 | ||||
2429 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_link_rsp); | |||
2430 | if (ret < 0) { | |||
2431 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2431 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2432 | rsp.op_ret = -1; | |||
2433 | rsp.op_errno = EINVAL22; | |||
2434 | goto out; | |||
2435 | } | |||
2436 | ||||
2437 | if (-1 != rsp.op_ret) { | |||
2438 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
2439 | ||||
2440 | gf_stat_to_iatt (&rsp.preparent, &preparent); | |||
2441 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
2442 | } | |||
2443 | ||||
2444 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2446, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2446, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2445 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2446, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2446, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2446 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2446, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2446, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2447 | ||||
2448 | out: | |||
2449 | if (rsp.op_ret == -1) { | |||
2450 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 2453, GF_LOG_WARNING, "remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0) | |||
2451 | "remote operation failed: %s (%s -> %s)",do { do { if (0) printf ("remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 2453, GF_LOG_WARNING, "remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0) | |||
2452 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 2453, GF_LOG_WARNING, "remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0) | |||
2453 | local->loc.path, local->loc2.path)do { do { if (0) printf ("remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); _gf_log (this->name , "client-rpc-fops.c", __FUNCTION__, 2453, GF_LOG_WARNING, "remote operation failed: %s (%s -> %s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, local->loc2.path); } while (0); | |||
2454 | } | |||
2455 | ||||
2456 | CLIENT_STACK_UNWIND (link, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2458, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2457 | gf_error_to_errno (rsp.op_errno), inode,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2458, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2458 | &stbuf, &preparent, &postparent, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2458, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), inode, &stbuf, &preparent, &postparent, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2459 | ||||
2460 | free (rsp.xdata.xdata_val); | |||
2461 | ||||
2462 | if (xdata) | |||
2463 | dict_unref (xdata); | |||
2464 | ||||
2465 | return 0; | |||
2466 | } | |||
2467 | ||||
2468 | ||||
2469 | int | |||
2470 | client3_3_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2471 | void *myframe) | |||
2472 | { | |||
2473 | clnt_local_t *local = NULL((void*)0); | |||
2474 | clnt_conf_t *conf = NULL((void*)0); | |||
2475 | call_frame_t *frame = NULL((void*)0); | |||
2476 | fd_t *fd = NULL((void*)0); | |||
2477 | int ret = 0; | |||
2478 | gfs3_opendir_rsp rsp = {0,}; | |||
2479 | xlator_t *this = NULL((void*)0); | |||
2480 | dict_t *xdata = NULL((void*)0); | |||
2481 | ||||
2482 | this = THIS(*__glusterfs_this_location()); | |||
2483 | ||||
2484 | frame = myframe; | |||
2485 | local = frame->local; | |||
2486 | ||||
2487 | conf = frame->this->private; | |||
2488 | fd = local->fd; | |||
2489 | ||||
2490 | if (-1 == req->rpc_status) { | |||
2491 | rsp.op_ret = -1; | |||
2492 | rsp.op_errno = ENOTCONN107; | |||
2493 | goto out; | |||
2494 | } | |||
2495 | ||||
2496 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_opendir_rsp); | |||
2497 | if (ret < 0) { | |||
2498 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2498 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2499 | rsp.op_ret = -1; | |||
2500 | rsp.op_errno = EINVAL22; | |||
2501 | goto out; | |||
2502 | } | |||
2503 | ||||
2504 | if (-1 != rsp.op_ret) { | |||
2505 | ret = client_add_fd_to_saved_fds (frame->this, fd, &local->loc, | |||
2506 | 0, rsp.fd, 1); | |||
2507 | if (ret) { | |||
2508 | rsp.op_ret = -1; | |||
2509 | rsp.op_errno = -ret; | |||
2510 | goto out; | |||
2511 | } | |||
2512 | } | |||
2513 | ||||
2514 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2516, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2516, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2515 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2516, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2516, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2516 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2516, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2516, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2517 | ||||
2518 | out: | |||
2519 | if (rsp.op_ret == -1) { | |||
2520 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2523, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
2521 | "remote operation failed: %s. Path: %s (%s)",do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2523, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
2522 | strerror (gf_error_to_errno (rsp.op_errno)),do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2523, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0) | |||
2523 | local->loc.path, loc_gfid_utoa (&local->loc))do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (gf_error_to_errno (rsp.op_errno)), local->loc. path, loc_gfid_utoa (&local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2523, GF_LOG_WARNING , "remote operation failed: %s. Path: %s (%s)", strerror (gf_error_to_errno (rsp.op_errno)), local->loc.path, loc_gfid_utoa (&local ->loc)); } while (0); | |||
2524 | } | |||
2525 | CLIENT_STACK_UNWIND (opendir, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_opendir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2526, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_opendir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2526 | gf_error_to_errno (rsp.op_errno), fd, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_opendir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2526, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_opendir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), fd, xdata); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2527 | ||||
2528 | free (rsp.xdata.xdata_val); | |||
2529 | ||||
2530 | if (xdata) | |||
2531 | dict_unref (xdata); | |||
2532 | ||||
2533 | return 0; | |||
2534 | } | |||
2535 | ||||
2536 | ||||
2537 | int | |||
2538 | client3_3_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2539 | void *myframe) | |||
2540 | { | |||
2541 | clnt_local_t *local = NULL((void*)0); | |||
2542 | call_frame_t *frame = NULL((void*)0); | |||
2543 | int ret = 0; | |||
2544 | gfs3_lookup_rsp rsp = {0,}; | |||
2545 | struct iatt stbuf = {0,}; | |||
2546 | struct iatt postparent = {0,}; | |||
2547 | int op_errno = EINVAL22; | |||
2548 | dict_t *xdata = NULL((void*)0); | |||
2549 | inode_t *inode = NULL((void*)0); | |||
2550 | xlator_t *this = NULL((void*)0); | |||
2551 | ||||
2552 | this = THIS(*__glusterfs_this_location()); | |||
2553 | ||||
2554 | frame = myframe; | |||
2555 | local = frame->local; | |||
2556 | inode = local->loc.inode; | |||
2557 | ||||
2558 | if (-1 == req->rpc_status) { | |||
2559 | rsp.op_ret = -1; | |||
2560 | op_errno = ENOTCONN107; | |||
2561 | goto out; | |||
2562 | } | |||
2563 | ||||
2564 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_lookup_rsp); | |||
2565 | if (ret < 0) { | |||
2566 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2566 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2567 | rsp.op_ret = -1; | |||
2568 | op_errno = EINVAL22; | |||
2569 | goto out; | |||
2570 | } | |||
2571 | ||||
2572 | op_errno = gf_error_to_errno (rsp.op_errno); | |||
2573 | gf_stat_to_iatt (&rsp.postparent, &postparent); | |||
2574 | ||||
2575 | if (rsp.op_ret == -1) | |||
2576 | goto out; | |||
2577 | ||||
2578 | rsp.op_ret = -1; | |||
2579 | gf_stat_to_iatt (&rsp.stat, &stbuf); | |||
2580 | ||||
2581 | GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2583, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2583, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
2582 | (rsp.xdata.xdata_len), rsp.op_ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2583, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2583, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0) | |||
2583 | op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (frame->this->name, "client-rpc-fops.c", __FUNCTION__, 2583, GF_LOG_ERROR, "invalid argument: " "xdata"); } while ( 0); goto out; } } while (0); rsp.op_ret = dict_unserialize (( rsp.xdata.xdata_val), (rsp.xdata.xdata_len), &xdata); if ( rsp.op_ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)" , ("xdata")); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2583, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); op_errno = 22; goto out; } } while (0); | |||
2584 | ||||
2585 | if ((!uuid_is_null (inode->gfid)) | |||
2586 | && (uuid_compare (stbuf.ia_gfid, inode->gfid) != 0)) { | |||
2587 | gf_log (frame->this->name, GF_LOG_DEBUG,do { do { if (0) printf ("gfid changed for %s", local->loc .path); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2588, GF_LOG_DEBUG, "gfid changed for %s", local ->loc.path); } while (0) | |||
2588 | "gfid changed for %s", local->loc.path)do { do { if (0) printf ("gfid changed for %s", local->loc .path); } while (0); _gf_log (frame->this->name, "client-rpc-fops.c" , __FUNCTION__, 2588, GF_LOG_DEBUG, "gfid changed for %s", local ->loc.path); } while (0); | |||
2589 | rsp.op_ret = -1; | |||
2590 | op_errno = ESTALE116; | |||
2591 | goto out; | |||
2592 | } | |||
2593 | ||||
2594 | rsp.op_ret = 0; | |||
2595 | ||||
2596 | out: | |||
2597 | rsp.op_errno = op_errno; | |||
2598 | if (rsp.op_ret == -1) { | |||
2599 | /* any error other than ENOENT */ | |||
2600 | if (rsp.op_errno != ENOENT2) | |||
2601 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2604, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0) | |||
2602 | "remote operation failed: %s. Path: %s (%s)",do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2604, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0) | |||
2603 | strerror (rsp.op_errno), local->loc.path,do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2604, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0) | |||
2604 | loc_gfid_utoa (&local->loc))do { do { if (0) printf ("remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2604, GF_LOG_WARNING, "remote operation failed: %s. Path: %s (%s)" , strerror (rsp.op_errno), local->loc.path, loc_gfid_utoa ( &local->loc)); } while (0); | |||
2605 | else | |||
2606 | gf_log (this->name, GF_LOG_TRACE, "not found on remote node")do { do { if (0) printf ("not found on remote node"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2606, GF_LOG_TRACE, "not found on remote node"); } while (0 ); | |||
2607 | ||||
2608 | } | |||
2609 | ||||
2610 | CLIENT_STACK_UNWIND (lookup, frame, rsp.op_ret, rsp.op_errno, inode,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2611, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, rsp.op_errno, inode, &stbuf, xdata, &postparent ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2611 | &stbuf, xdata, &postparent)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2611, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, rsp.op_errno, inode, &stbuf, xdata, &postparent ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2612 | ||||
2613 | if (xdata) | |||
2614 | dict_unref (xdata); | |||
2615 | ||||
2616 | free (rsp.xdata.xdata_val); | |||
2617 | ||||
2618 | return 0; | |||
2619 | } | |||
2620 | ||||
2621 | int | |||
2622 | client3_3_readv_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2623 | void *myframe) | |||
2624 | { | |||
2625 | call_frame_t *frame = NULL((void*)0); | |||
2626 | struct iobref *iobref = NULL((void*)0); | |||
2627 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
2628 | struct iatt stat = {0,}; | |||
2629 | gfs3_read_rsp rsp = {0,}; | |||
2630 | int ret = 0, rspcount = 0; | |||
2631 | clnt_local_t *local = NULL((void*)0); | |||
2632 | xlator_t *this = NULL((void*)0); | |||
2633 | dict_t *xdata = NULL((void*)0); | |||
2634 | ||||
2635 | this = THIS(*__glusterfs_this_location()); | |||
2636 | ||||
2637 | memset (vector, 0, sizeof (vector)); | |||
2638 | ||||
2639 | frame = myframe; | |||
2640 | local = frame->local; | |||
2641 | ||||
2642 | if (-1 == req->rpc_status) { | |||
2643 | rsp.op_ret = -1; | |||
2644 | rsp.op_errno = ENOTCONN107; | |||
2645 | goto out; | |||
2646 | } | |||
2647 | ||||
2648 | ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gfs3_read_rsp); | |||
2649 | if (ret < 0) { | |||
2650 | gf_log (this->name, GF_LOG_ERROR, "XDR decoding failed")do { do { if (0) printf ("XDR decoding failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2650 , GF_LOG_ERROR, "XDR decoding failed"); } while (0); | |||
2651 | rsp.op_ret = -1; | |||
2652 | rsp.op_errno = EINVAL22; | |||
2653 | goto out; | |||
2654 | } | |||
2655 | ||||
2656 | if (rsp.op_ret != -1) { | |||
2657 | iobref = req->rsp_iobref; | |||
2658 | gf_stat_to_iatt (&rsp.stat, &stat); | |||
2659 | ||||
2660 | vector[0].iov_len = rsp.op_ret; | |||
2661 | if (rsp.op_ret > 0) | |||
2662 | vector[0].iov_base = req->rsp[1].iov_base; | |||
2663 | rspcount = 1; | |||
2664 | } | |||
2665 | GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2667, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2667, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2666 | (rsp.xdata.xdata_len), ret,do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2667, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2667, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0) | |||
2667 | rsp.op_errno, out)do { if (!(rsp.xdata.xdata_len)) break; xdata = dict_new(); do { if (!xdata) { (*__errno_location ()) = 22; do { do { if (0 ) printf ("invalid argument: " "xdata"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2667, GF_LOG_ERROR , "invalid argument: " "xdata"); } while (0); goto out; } } while (0); ret = dict_unserialize ((rsp.xdata.xdata_val), (rsp.xdata .xdata_len), &xdata); if (ret < 0) { do { do { if (0) printf ("failed to unserialize dictionary (%s)", ("xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2667, GF_LOG_WARNING, "failed to unserialize dictionary (%s)" , ("xdata")); } while (0); rsp.op_errno = 22; goto out; } } while (0); | |||
2668 | ||||
2669 | #ifdef GF_TESTING_IO_XDATA | |||
2670 | dict_dump (xdata); | |||
2671 | #endif | |||
2672 | ||||
2673 | out: | |||
2674 | if (rsp.op_ret == -1) { | |||
2675 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2677, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2676 | "remote operation failed: %s",do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2677, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0) | |||
2677 | strerror (gf_error_to_errno (rsp.op_errno)))do { do { if (0) printf ("remote operation failed: %s", strerror (gf_error_to_errno (rsp.op_errno))); } while (0); _gf_log (this ->name, "client-rpc-fops.c", __FUNCTION__, 2677, GF_LOG_WARNING , "remote operation failed: %s", strerror (gf_error_to_errno ( rsp.op_errno))); } while (0); | |||
2678 | } else if (rsp.op_ret >= 0) { | |||
2679 | if (local->attempt_reopen) | |||
2680 | client_attempt_reopen (local->fd, this); | |||
2681 | } | |||
2682 | CLIENT_STACK_UNWIND (readv, frame, rsp.op_ret,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2684, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readv_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), vector, rspcount, & stat, iobref, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
2683 | gf_error_to_errno (rsp.op_errno), vector, rspcount,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2684, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readv_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), vector, rspcount, & stat, iobref, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
2684 | &stat, iobref, xdata)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2684, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readv_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, rsp .op_ret, gf_error_to_errno (rsp.op_errno), vector, rspcount, & stat, iobref, xdata); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
2685 | ||||
2686 | free (rsp.xdata.xdata_val); | |||
2687 | ||||
2688 | if (xdata) | |||
2689 | dict_unref (xdata); | |||
2690 | ||||
2691 | return 0; | |||
2692 | } | |||
2693 | ||||
2694 | int | |||
2695 | client3_3_release_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2696 | void *myframe) | |||
2697 | { | |||
2698 | call_frame_t *frame = NULL((void*)0); | |||
2699 | ||||
2700 | frame = myframe; | |||
2701 | STACK_DESTROY (frame->root); | |||
2702 | return 0; | |||
2703 | } | |||
2704 | int | |||
2705 | client3_3_releasedir_cbk (struct rpc_req *req, struct iovec *iov, int count, | |||
2706 | void *myframe) | |||
2707 | { | |||
2708 | call_frame_t *frame = NULL((void*)0); | |||
2709 | ||||
2710 | frame = myframe; | |||
2711 | STACK_DESTROY (frame->root); | |||
2712 | return 0; | |||
2713 | } | |||
2714 | ||||
2715 | int | |||
2716 | client_fdctx_destroy (xlator_t *this, clnt_fd_ctx_t *fdctx) | |||
2717 | { | |||
2718 | clnt_conf_t *conf = NULL((void*)0); | |||
2719 | call_frame_t *fr = NULL((void*)0); | |||
2720 | int32_t ret = -1; | |||
2721 | char parent_down = 0; | |||
2722 | fd_lk_ctx_t *lk_ctx = NULL((void*)0); | |||
2723 | ||||
2724 | GF_VALIDATE_OR_GOTO ("client", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn ("client", "client-rpc-fops.c", __FUNCTION__, 2724, GF_LOG_ERROR , "invalid argument: " "this"); } while (0); goto out; } } while (0); | |||
2725 | GF_VALIDATE_OR_GOTO (this->name, fdctx, out)do { if (!fdctx) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "fdctx"); } while (0); _gf_log_callingfn (this->name, "client-rpc-fops.c", __FUNCTION__, 2725, GF_LOG_ERROR , "invalid argument: " "fdctx"); } while (0); goto out; } } while (0); | |||
2726 | ||||
2727 | conf = (clnt_conf_t *) this->private; | |||
2728 | ||||
2729 | if (fdctx->remote_fd == -1) { | |||
2730 | gf_log (this->name, GF_LOG_DEBUG, "not a valid fd")do { do { if (0) printf ("not a valid fd"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2730, GF_LOG_DEBUG , "not a valid fd"); } while (0); | |||
2731 | goto out; | |||
2732 | } | |||
2733 | ||||
2734 | pthread_mutex_lock (&conf->lock); | |||
2735 | { | |||
2736 | parent_down = conf->parent_down; | |||
2737 | lk_ctx = fdctx->lk_ctx; | |||
2738 | fdctx->lk_ctx = NULL((void*)0); | |||
2739 | } | |||
2740 | pthread_mutex_unlock (&conf->lock); | |||
2741 | ||||
2742 | if (lk_ctx) | |||
2743 | fd_lk_ctx_unref (lk_ctx); | |||
2744 | ||||
2745 | if (!parent_down) | |||
2746 | rpc_clnt_ref (conf->rpc); | |||
2747 | else | |||
2748 | goto out; | |||
2749 | ||||
2750 | fr = create_frame (this, this->ctx->pool); | |||
2751 | if (fr == NULL((void*)0)) { | |||
2752 | goto out; | |||
2753 | } | |||
2754 | ||||
2755 | ret = 0; | |||
2756 | ||||
2757 | if (fdctx->is_dir) { | |||
2758 | gfs3_releasedir_req req = {{0,},}; | |||
2759 | req.fd = fdctx->remote_fd; | |||
2760 | gf_log (this->name, GF_LOG_DEBUG, "sending releasedir on fd")do { do { if (0) printf ("sending releasedir on fd"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2760, GF_LOG_DEBUG, "sending releasedir on fd"); } while (0 ); | |||
2761 | client_submit_request (this, &req, fr, &clnt3_3_fop_prog, | |||
2762 | GFS3_OP_RELEASEDIR, | |||
2763 | client3_3_releasedir_cbk, | |||
2764 | NULL((void*)0), NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
2765 | (xdrproc_t)xdr_gfs3_releasedir_req); | |||
2766 | } else { | |||
2767 | gfs3_release_req req = {{0,},}; | |||
2768 | req.fd = fdctx->remote_fd; | |||
2769 | gf_log (this->name, GF_LOG_DEBUG, "sending release on fd")do { do { if (0) printf ("sending release on fd"); } while (0 ); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 2769, GF_LOG_DEBUG, "sending release on fd"); } while (0); | |||
2770 | client_submit_request (this, &req, fr, &clnt3_3_fop_prog, | |||
2771 | GFS3_OP_RELEASE, | |||
2772 | client3_3_release_cbk, NULL((void*)0), | |||
2773 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
2774 | (xdrproc_t)xdr_gfs3_release_req); | |||
2775 | } | |||
2776 | ||||
2777 | rpc_clnt_unref (conf->rpc); | |||
2778 | out: | |||
2779 | if (fdctx) { | |||
2780 | fdctx->remote_fd = -1; | |||
2781 | GF_FREE (fdctx)__gf_free (fdctx); | |||
2782 | } | |||
2783 | ||||
2784 | if (ret && fr) | |||
2785 | STACK_DESTROY (fr->root); | |||
2786 | ||||
2787 | return ret; | |||
2788 | } | |||
2789 | ||||
2790 | int32_t | |||
2791 | client3_3_releasedir (call_frame_t *frame, xlator_t *this, | |||
2792 | void *data) | |||
2793 | { | |||
2794 | clnt_conf_t *conf = NULL((void*)0); | |||
2795 | clnt_fd_ctx_t *fdctx = NULL((void*)0); | |||
2796 | clnt_args_t *args = NULL((void*)0); | |||
2797 | int64_t remote_fd = -1; | |||
2798 | ||||
2799 | if (!this || !data) | |||
2800 | goto out; | |||
2801 | ||||
2802 | args = data; | |||
2803 | conf = this->private; | |||
2804 | ||||
2805 | pthread_mutex_lock (&conf->lock); | |||
2806 | { | |||
2807 | fdctx = this_fd_del_ctx (args->fd, this); | |||
2808 | if (fdctx != NULL((void*)0)) { | |||
2809 | remote_fd = fdctx->remote_fd; | |||
2810 | ||||
2811 | /* fdctx->remote_fd == -1 indicates a reopen attempt | |||
2812 | in progress. Just mark ->released = 1 and let | |||
2813 | reopen_cbk handle releasing | |||
2814 | */ | |||
2815 | ||||
2816 | if (remote_fd != -1) | |||
2817 | list_del_init (&fdctx->sfd_pos); | |||
2818 | ||||
2819 | fdctx->released = 1; | |||
2820 | } | |||
2821 | } | |||
2822 | pthread_mutex_unlock (&conf->lock); | |||
2823 | ||||
2824 | if (remote_fd != -1) | |||
2825 | client_fdctx_destroy (this, fdctx); | |||
2826 | out: | |||
2827 | ||||
2828 | return 0; | |||
2829 | } | |||
2830 | ||||
2831 | int32_t | |||
2832 | client3_3_release (call_frame_t *frame, xlator_t *this, | |||
2833 | void *data) | |||
2834 | { | |||
2835 | int64_t remote_fd = -1; | |||
2836 | clnt_conf_t *conf = NULL((void*)0); | |||
2837 | clnt_fd_ctx_t *fdctx = NULL((void*)0); | |||
2838 | clnt_args_t *args = NULL((void*)0); | |||
2839 | lk_heal_state_t lk_heal_state = GF_LK_HEAL_DONE; | |||
2840 | ||||
2841 | if (!this || !data) | |||
2842 | goto out; | |||
2843 | ||||
2844 | args = data; | |||
2845 | conf = this->private; | |||
2846 | ||||
2847 | pthread_mutex_lock (&conf->lock); | |||
2848 | { | |||
2849 | fdctx = this_fd_del_ctx (args->fd, this); | |||
2850 | if (fdctx != NULL((void*)0)) { | |||
2851 | remote_fd = fdctx->remote_fd; | |||
2852 | lk_heal_state = fdctx->lk_heal_state; | |||
2853 | ||||
2854 | /* fdctx->remote_fd == -1 indicates a reopen attempt | |||
2855 | in progress. Just mark ->released = 1 and let | |||
2856 | reopen_cbk handle releasing | |||
2857 | */ | |||
2858 | ||||
2859 | if (remote_fd != -1 && | |||
2860 | lk_heal_state == GF_LK_HEAL_DONE) | |||
2861 | list_del_init (&fdctx->sfd_pos); | |||
2862 | ||||
2863 | fdctx->released = 1; | |||
2864 | } | |||
2865 | } | |||
2866 | pthread_mutex_unlock (&conf->lock); | |||
2867 | ||||
2868 | if (remote_fd != -1 && lk_heal_state == GF_LK_HEAL_DONE) | |||
2869 | client_fdctx_destroy (this, fdctx); | |||
2870 | out: | |||
2871 | return 0; | |||
2872 | } | |||
2873 | ||||
2874 | ||||
2875 | int32_t | |||
2876 | client3_3_lookup (call_frame_t *frame, xlator_t *this, | |||
2877 | void *data) | |||
2878 | { | |||
2879 | clnt_conf_t *conf = NULL((void*)0); | |||
2880 | clnt_local_t *local = NULL((void*)0); | |||
2881 | clnt_args_t *args = NULL((void*)0); | |||
2882 | gfs3_lookup_req req = {{0,},}; | |||
2883 | int ret = 0; | |||
2884 | int op_errno = ESTALE116; | |||
2885 | data_t *content = NULL((void*)0); | |||
2886 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
2887 | int count = 0; | |||
2888 | struct iobref *rsp_iobref = NULL((void*)0); | |||
2889 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
2890 | struct iovec *rsphdr = NULL((void*)0); | |||
2891 | ||||
2892 | if (!frame || !this || !data) | |||
2893 | goto unwind; | |||
2894 | ||||
2895 | memset (vector, 0, sizeof (vector)); | |||
2896 | ||||
2897 | conf = this->private; | |||
2898 | args = data; | |||
2899 | local = mem_get0 (this->local_pool); | |||
2900 | if (!local) { | |||
2901 | op_errno = ENOMEM12; | |||
2902 | goto unwind; | |||
2903 | } | |||
2904 | ||||
2905 | if (!(args->loc && args->loc->inode)) | |||
2906 | goto unwind; | |||
2907 | ||||
2908 | loc_copy (&local->loc, args->loc); | |||
2909 | loc_path (&local->loc, NULL((void*)0)); | |||
2910 | frame->local = local; | |||
2911 | ||||
2912 | if (args->loc->parent) { | |||
2913 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
2914 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
2915 | else | |||
2916 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
2917 | } else { | |||
2918 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
2919 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
2920 | else | |||
2921 | memcpy (req.gfid, args->loc->gfid, 16); | |||
2922 | } | |||
2923 | ||||
2924 | if (args->xdata) { | |||
2925 | content = dict_get (args->xdata, GF_CONTENT_KEY"glusterfs.content"); | |||
2926 | if (content != NULL((void*)0)) { | |||
2927 | rsp_iobref = iobref_new (); | |||
2928 | if (rsp_iobref == NULL((void*)0)) { | |||
2929 | goto unwind; | |||
2930 | } | |||
2931 | ||||
2932 | /* TODO: what is the size we should send ? */ | |||
2933 | /* This change very much depends on quick-read | |||
2934 | changes */ | |||
2935 | rsp_iobuf = iobuf_get (this->ctx->iobuf_pool); | |||
2936 | if (rsp_iobuf == NULL((void*)0)) { | |||
2937 | goto unwind; | |||
2938 | } | |||
2939 | ||||
2940 | iobref_add (rsp_iobref, rsp_iobuf); | |||
2941 | iobuf_unref (rsp_iobuf); | |||
2942 | rsphdr = &vector[0]; | |||
2943 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
2944 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
2945 | count = 1; | |||
2946 | local->iobref = rsp_iobref; | |||
2947 | rsp_iobuf = NULL((void*)0); | |||
2948 | rsp_iobref = NULL((void*)0); | |||
2949 | } | |||
2950 | ||||
2951 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata,do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2954, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
2952 | (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2954, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
2953 | req.xdata.xdata_len,do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2954, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
2954 | op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 2954, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
2955 | } | |||
2956 | ||||
2957 | if (args->loc->name) | |||
2958 | req.bname = (char *)args->loc->name; | |||
2959 | else | |||
2960 | req.bname = ""; | |||
2961 | ||||
2962 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
2963 | GFS3_OP_LOOKUP, client3_3_lookup_cbk, | |||
2964 | NULL((void*)0), rsphdr, count, | |||
2965 | NULL((void*)0), 0, local->iobref, | |||
2966 | (xdrproc_t)xdr_gfs3_lookup_req); | |||
2967 | ||||
2968 | if (ret) { | |||
2969 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 2969, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
2970 | } | |||
2971 | ||||
2972 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
2973 | ||||
2974 | if (rsp_iobref) | |||
2975 | iobref_unref (rsp_iobref); | |||
2976 | ||||
2977 | if (rsp_iobuf) | |||
2978 | iobuf_unref (rsp_iobuf); | |||
2979 | ||||
2980 | return 0; | |||
2981 | ||||
2982 | unwind: | |||
2983 | CLIENT_STACK_UNWIND (lookup, frame, -1, op_errno, NULL, NULL, NULL,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2984, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); ( *__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
2984 | NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 2984, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lookup_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); ( *__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
2985 | ||||
2986 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
2987 | ||||
2988 | if (rsp_iobref) | |||
2989 | iobref_unref (rsp_iobref); | |||
2990 | ||||
2991 | if (rsp_iobuf) | |||
2992 | iobuf_unref (rsp_iobuf); | |||
2993 | ||||
2994 | return 0; | |||
2995 | } | |||
2996 | ||||
2997 | int32_t | |||
2998 | client3_3_stat (call_frame_t *frame, xlator_t *this, | |||
2999 | void *data) | |||
3000 | { | |||
3001 | clnt_conf_t *conf = NULL((void*)0); | |||
3002 | clnt_args_t *args = NULL((void*)0); | |||
3003 | gfs3_stat_req req = {{0,},}; | |||
3004 | int ret = 0; | |||
3005 | int op_errno = ESTALE116; | |||
3006 | ||||
3007 | if (!frame || !this || !data) | |||
3008 | goto unwind; | |||
3009 | ||||
3010 | args = data; | |||
3011 | if (!(args->loc && args->loc->inode)) | |||
3012 | goto unwind; | |||
3013 | ||||
3014 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
3015 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
3016 | else | |||
3017 | memcpy (req.gfid, args->loc->gfid, 16); | |||
3018 | ||||
3019 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3021, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3020 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3021, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3021 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3021, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3022 | conf = this->private; | |||
3023 | ||||
3024 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3025, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3025 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3025, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3026 | ||||
3027 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3028 | GFS3_OP_STAT, client3_3_stat_cbk, NULL((void*)0), | |||
3029 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
3030 | (xdrproc_t)xdr_gfs3_stat_req); | |||
3031 | if (ret) { | |||
3032 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3032, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3033 | } | |||
3034 | ||||
3035 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3036 | ||||
3037 | return 0; | |||
3038 | unwind: | |||
3039 | CLIENT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_stat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3039, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_stat_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3040 | ||||
3041 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3042 | ||||
3043 | return 0; | |||
3044 | } | |||
3045 | ||||
3046 | ||||
3047 | int32_t | |||
3048 | client3_3_truncate (call_frame_t *frame, xlator_t *this, | |||
3049 | void *data) | |||
3050 | { | |||
3051 | clnt_conf_t *conf = NULL((void*)0); | |||
3052 | clnt_args_t *args = NULL((void*)0); | |||
3053 | gfs3_truncate_req req = {{0,},}; | |||
3054 | int ret = 0; | |||
3055 | int op_errno = ESTALE116; | |||
3056 | ||||
3057 | if (!frame || !this || !data) | |||
3058 | goto unwind; | |||
3059 | ||||
3060 | args = data; | |||
3061 | ||||
3062 | if (!(args->loc && args->loc->inode)) | |||
3063 | goto unwind; | |||
3064 | ||||
3065 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
3066 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
3067 | else | |||
3068 | memcpy (req.gfid, args->loc->gfid, 16); | |||
3069 | ||||
3070 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3072, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3071 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3072, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3072 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3072, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3073 | req.offset = args->offset; | |||
3074 | ||||
3075 | conf = this->private; | |||
3076 | ||||
3077 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3078, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3078 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3078, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3079 | ||||
3080 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3081 | GFS3_OP_TRUNCATE, | |||
3082 | client3_3_truncate_cbk, NULL((void*)0), | |||
3083 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3084 | NULL((void*)0), (xdrproc_t)xdr_gfs3_truncate_req); | |||
3085 | if (ret) { | |||
3086 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3086, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3087 | } | |||
3088 | ||||
3089 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3090 | ||||
3091 | return 0; | |||
3092 | unwind: | |||
3093 | CLIENT_STACK_UNWIND (truncate, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3093, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_truncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3094 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3095 | ||||
3096 | return 0; | |||
3097 | } | |||
3098 | ||||
3099 | ||||
3100 | int32_t | |||
3101 | client3_3_ftruncate (call_frame_t *frame, xlator_t *this, | |||
3102 | void *data) | |||
3103 | { | |||
3104 | clnt_args_t *args = NULL((void*)0); | |||
3105 | int64_t remote_fd = -1; | |||
3106 | clnt_conf_t *conf = NULL((void*)0); | |||
3107 | gfs3_ftruncate_req req = {{0,},}; | |||
3108 | int op_errno = EINVAL22; | |||
3109 | int ret = 0; | |||
3110 | ||||
3111 | if (!frame || !this || !data) | |||
3112 | goto unwind; | |||
3113 | ||||
3114 | args = data; | |||
3115 | ||||
3116 | conf = this->private; | |||
3117 | ||||
3118 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 3119, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
3119 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 3119, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
3120 | ||||
3121 | req.offset = args->offset; | |||
3122 | req.fd = remote_fd; | |||
3123 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
3124 | ||||
3125 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3126, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3126 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3126, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3127 | ||||
3128 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3129 | GFS3_OP_FTRUNCATE, | |||
3130 | client3_3_ftruncate_cbk, NULL((void*)0), | |||
3131 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3132 | NULL((void*)0), (xdrproc_t)xdr_gfs3_ftruncate_req); | |||
3133 | if (ret) { | |||
3134 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3134, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3135 | } | |||
3136 | ||||
3137 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3138 | ||||
3139 | return 0; | |||
3140 | unwind: | |||
3141 | CLIENT_STACK_UNWIND (ftruncate, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3141, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_ftruncate_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3142 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3143 | ||||
3144 | return 0; | |||
3145 | } | |||
3146 | ||||
3147 | ||||
3148 | ||||
3149 | int32_t | |||
3150 | client3_3_access (call_frame_t *frame, xlator_t *this, | |||
3151 | void *data) | |||
3152 | { | |||
3153 | clnt_conf_t *conf = NULL((void*)0); | |||
3154 | clnt_args_t *args = NULL((void*)0); | |||
3155 | gfs3_access_req req = {{0,},}; | |||
3156 | int ret = 0; | |||
3157 | int op_errno = ESTALE116; | |||
3158 | ||||
3159 | if (!frame || !this || !data) | |||
3160 | goto unwind; | |||
3161 | ||||
3162 | args = data; | |||
3163 | ||||
3164 | if (!(args->loc && args->loc->inode)) | |||
3165 | goto unwind; | |||
3166 | ||||
3167 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
3168 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
3169 | else | |||
3170 | memcpy (req.gfid, args->loc->gfid, 16); | |||
3171 | ||||
3172 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3174, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3173 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3174, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3174 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3174, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3175 | req.mask = args->mask; | |||
3176 | ||||
3177 | conf = this->private; | |||
3178 | ||||
3179 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3180, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3180 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3180, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3181 | ||||
3182 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3183 | GFS3_OP_ACCESS, | |||
3184 | client3_3_access_cbk, NULL((void*)0), | |||
3185 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3186 | NULL((void*)0), (xdrproc_t)xdr_gfs3_access_req); | |||
3187 | if (ret) { | |||
3188 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3188, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3189 | } | |||
3190 | ||||
3191 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3192 | ||||
3193 | return 0; | |||
3194 | unwind: | |||
3195 | CLIENT_STACK_UNWIND (access, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_access_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3195, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_access_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
3196 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3197 | ||||
3198 | return 0; | |||
3199 | } | |||
3200 | ||||
3201 | int32_t | |||
3202 | client3_3_readlink (call_frame_t *frame, xlator_t *this, | |||
3203 | void *data) | |||
3204 | { | |||
3205 | clnt_conf_t *conf = NULL((void*)0); | |||
3206 | clnt_args_t *args = NULL((void*)0); | |||
3207 | gfs3_readlink_req req = {{0,},}; | |||
3208 | int ret = 0; | |||
3209 | int op_errno = ESTALE116; | |||
3210 | clnt_local_t *local = NULL((void*)0); | |||
3211 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
3212 | struct iobref *rsp_iobref = NULL((void*)0); | |||
3213 | struct iovec *rsphdr = NULL((void*)0); | |||
3214 | int count = 0; | |||
3215 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
3216 | ||||
3217 | if (!frame || !this || !data) | |||
3218 | goto unwind; | |||
3219 | ||||
3220 | args = data; | |||
3221 | ||||
3222 | if (!(args->loc && args->loc->inode)) | |||
3223 | goto unwind; | |||
3224 | ||||
3225 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
3226 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
3227 | else | |||
3228 | memcpy (req.gfid, args->loc->gfid, 16); | |||
3229 | ||||
3230 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3232, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3231 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3232, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3232 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3232, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3233 | req.size = args->size; | |||
3234 | conf = this->private; | |||
3235 | ||||
3236 | local = mem_get0 (this->local_pool); | |||
3237 | if (!local) { | |||
3238 | op_errno = ENOMEM12; | |||
3239 | goto unwind; | |||
3240 | } | |||
3241 | ||||
3242 | frame->local = local; | |||
3243 | ||||
3244 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3245, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3245 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3245, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3246 | ||||
3247 | rsp_iobref = iobref_new (); | |||
3248 | if (rsp_iobref == NULL((void*)0)) { | |||
3249 | goto unwind; | |||
3250 | } | |||
3251 | ||||
3252 | rsp_iobuf = iobuf_get (this->ctx->iobuf_pool); | |||
3253 | if (rsp_iobuf == NULL((void*)0)) { | |||
3254 | goto unwind; | |||
3255 | } | |||
3256 | ||||
3257 | iobref_add (rsp_iobref, rsp_iobuf); | |||
3258 | iobuf_unref (rsp_iobuf); | |||
3259 | rsphdr = &vector[0]; | |||
3260 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
3261 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
3262 | count = 1; | |||
3263 | local->iobref = rsp_iobref; | |||
3264 | rsp_iobuf = NULL((void*)0); | |||
3265 | rsp_iobref = NULL((void*)0); | |||
3266 | ||||
3267 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3268 | GFS3_OP_READLINK, | |||
3269 | client3_3_readlink_cbk, NULL((void*)0), | |||
3270 | rsphdr, count, NULL((void*)0), 0, | |||
3271 | local->iobref, | |||
3272 | (xdrproc_t)xdr_gfs3_readlink_req); | |||
3273 | if (ret) { | |||
3274 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3274, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3275 | } | |||
3276 | ||||
3277 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3278 | ||||
3279 | return 0; | |||
3280 | unwind: | |||
3281 | if (rsp_iobref != NULL((void*)0)) { | |||
3282 | iobref_unref (rsp_iobref); | |||
3283 | } | |||
3284 | ||||
3285 | CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3285, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readlink_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3286 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3287 | ||||
3288 | return 0; | |||
3289 | } | |||
3290 | ||||
3291 | ||||
3292 | ||||
3293 | ||||
3294 | int32_t | |||
3295 | client3_3_unlink (call_frame_t *frame, xlator_t *this, | |||
3296 | void *data) | |||
3297 | { | |||
3298 | clnt_conf_t *conf = NULL((void*)0); | |||
3299 | clnt_args_t *args = NULL((void*)0); | |||
3300 | gfs3_unlink_req req = {{0,},}; | |||
3301 | int ret = 0; | |||
3302 | int op_errno = 0; | |||
3303 | ||||
3304 | if (!frame || !this || !data) | |||
3305 | goto unwind; | |||
3306 | ||||
3307 | args = data; | |||
3308 | ||||
3309 | if (!(args->loc && args->loc->parent)) | |||
3310 | goto unwind; | |||
3311 | ||||
3312 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
3313 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
3314 | else | |||
3315 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
3316 | ||||
3317 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3319, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3318 | !uuid_is_null (*((uuid_t*)req.pargfid)),do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3319, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3319 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3319, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3320 | req.bname = (char *)args->loc->name; | |||
3321 | conf = this->private; | |||
3322 | ||||
3323 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3324, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3324 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3324, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3325 | ||||
3326 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3327 | GFS3_OP_UNLINK, | |||
3328 | client3_3_unlink_cbk, NULL((void*)0), | |||
3329 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3330 | NULL((void*)0), (xdrproc_t)xdr_gfs3_unlink_req); | |||
3331 | if (ret) { | |||
3332 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3332, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3333 | } | |||
3334 | ||||
3335 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3336 | ||||
3337 | return 0; | |||
3338 | unwind: | |||
3339 | CLIENT_STACK_UNWIND (unlink, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3339, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_unlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3340 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3341 | ||||
3342 | return 0; | |||
3343 | } | |||
3344 | ||||
3345 | ||||
3346 | ||||
3347 | int32_t | |||
3348 | client3_3_rmdir (call_frame_t *frame, xlator_t *this, | |||
3349 | void *data) | |||
3350 | { | |||
3351 | clnt_conf_t *conf = NULL((void*)0); | |||
3352 | clnt_args_t *args = NULL((void*)0); | |||
3353 | gfs3_rmdir_req req = {{0,},}; | |||
3354 | int ret = 0; | |||
3355 | int op_errno = ESTALE116; | |||
3356 | ||||
3357 | if (!frame || !this || !data) | |||
3358 | goto unwind; | |||
3359 | ||||
3360 | args = data; | |||
3361 | ||||
3362 | if (!(args->loc && args->loc->parent)) | |||
3363 | goto unwind; | |||
3364 | ||||
3365 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
3366 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
3367 | else | |||
3368 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
3369 | ||||
3370 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3372, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3371 | !uuid_is_null (*((uuid_t*)req.pargfid)),do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3372, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3372 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3372, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3373 | req.bname = (char *)args->loc->name; | |||
3374 | req.xflags = args->flags; | |||
3375 | conf = this->private; | |||
3376 | ||||
3377 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3378, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3378 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3378, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3379 | ||||
3380 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3381 | GFS3_OP_RMDIR, client3_3_rmdir_cbk, NULL((void*)0), | |||
3382 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3383 | NULL((void*)0), (xdrproc_t)xdr_gfs3_rmdir_req); | |||
3384 | if (ret) { | |||
3385 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3385, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3386 | } | |||
3387 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3388 | ||||
3389 | return 0; | |||
3390 | unwind: | |||
3391 | CLIENT_STACK_UNWIND (rmdir, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3391, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rmdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3392 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3393 | ||||
3394 | return 0; | |||
3395 | } | |||
3396 | ||||
3397 | ||||
3398 | ||||
3399 | int32_t | |||
3400 | client3_3_symlink (call_frame_t *frame, xlator_t *this, | |||
3401 | void *data) | |||
3402 | { | |||
3403 | clnt_local_t *local = NULL((void*)0); | |||
3404 | clnt_conf_t *conf = NULL((void*)0); | |||
3405 | clnt_args_t *args = NULL((void*)0); | |||
3406 | gfs3_symlink_req req = {{0,},}; | |||
3407 | int ret = 0; | |||
3408 | int op_errno = ESTALE116; | |||
3409 | ||||
3410 | if (!frame || !this || !data) | |||
3411 | goto unwind; | |||
3412 | ||||
3413 | args = data; | |||
3414 | local = mem_get0 (this->local_pool); | |||
3415 | if (!local) { | |||
3416 | op_errno = ENOMEM12; | |||
3417 | goto unwind; | |||
3418 | } | |||
3419 | ||||
3420 | frame->local = local; | |||
3421 | ||||
3422 | if (!(args->loc && args->loc->parent)) | |||
3423 | goto unwind; | |||
3424 | ||||
3425 | loc_copy (&local->loc, args->loc); | |||
3426 | loc_path (&local->loc, NULL((void*)0)); | |||
3427 | ||||
3428 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
3429 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
3430 | else | |||
3431 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
3432 | ||||
3433 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3435, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3434 | !uuid_is_null (*((uuid_t*)req.pargfid)),do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3435, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3435 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3435, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3436 | req.linkname = (char *)args->linkname; | |||
3437 | req.bname = (char *)args->loc->name; | |||
3438 | req.umask = args->umask; | |||
3439 | local->loc2.path = gf_strdup (req.linkname); | |||
3440 | ||||
3441 | conf = this->private; | |||
3442 | ||||
3443 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3444, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3444 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3444, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3445 | ||||
3446 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3447 | GFS3_OP_SYMLINK, client3_3_symlink_cbk, | |||
3448 | NULL((void*)0), NULL((void*)0), 0, NULL((void*)0), | |||
3449 | 0, NULL((void*)0), (xdrproc_t)xdr_gfs3_symlink_req); | |||
3450 | if (ret) { | |||
3451 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3451, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3452 | } | |||
3453 | ||||
3454 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3455 | ||||
3456 | return 0; | |||
3457 | unwind: | |||
3458 | ||||
3459 | CLIENT_STACK_UNWIND (symlink, frame, -1, op_errno, NULL, NULL, NULL,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3460, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
3460 | NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3460, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_symlink_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3461 | ||||
3462 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3463 | ||||
3464 | return 0; | |||
3465 | } | |||
3466 | ||||
3467 | ||||
3468 | ||||
3469 | int32_t | |||
3470 | client3_3_rename (call_frame_t *frame, xlator_t *this, | |||
3471 | void *data) | |||
3472 | { | |||
3473 | clnt_conf_t *conf = NULL((void*)0); | |||
3474 | clnt_args_t *args = NULL((void*)0); | |||
3475 | gfs3_rename_req req = {{0,},}; | |||
3476 | int ret = 0; | |||
3477 | int op_errno = ESTALE116; | |||
3478 | ||||
3479 | if (!frame || !this || !data) | |||
3480 | goto unwind; | |||
3481 | ||||
3482 | args = data; | |||
3483 | ||||
3484 | if (!(args->oldloc && args->newloc && args->oldloc->parent && | |||
3485 | args->newloc->parent)) | |||
3486 | goto unwind; | |||
3487 | ||||
3488 | if (!uuid_is_null (args->oldloc->parent->gfid)) | |||
3489 | memcpy (req.oldgfid, args->oldloc->parent->gfid, 16); | |||
3490 | else | |||
3491 | memcpy (req.oldgfid, args->oldloc->pargfid, 16); | |||
3492 | ||||
3493 | if (!uuid_is_null (args->newloc->parent->gfid)) | |||
3494 | memcpy (req.newgfid, args->newloc->parent->gfid, 16); | |||
3495 | else | |||
3496 | memcpy (req.newgfid, args->newloc->pargfid, 16); | |||
3497 | ||||
3498 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.oldgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3500, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3499 | !uuid_is_null (*((uuid_t*)req.oldgfid)),do { if (!!uuid_is_null (*((uuid_t*)req.oldgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3500, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3500 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.oldgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3500, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3501 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.newgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3503, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3502 | !uuid_is_null (*((uuid_t*)req.newgfid)),do { if (!!uuid_is_null (*((uuid_t*)req.newgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3503, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3503 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.newgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3503, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3504 | req.oldbname = (char *)args->oldloc->name; | |||
3505 | req.newbname = (char *)args->newloc->name; | |||
3506 | conf = this->private; | |||
3507 | ||||
3508 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3509, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3509 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3509, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3510 | ||||
3511 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3512 | GFS3_OP_RENAME, client3_3_rename_cbk, NULL((void*)0), | |||
3513 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3514 | NULL((void*)0), (xdrproc_t)xdr_gfs3_rename_req); | |||
3515 | if (ret) { | |||
3516 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3516, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3517 | } | |||
3518 | ||||
3519 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3520 | ||||
3521 | return 0; | |||
3522 | unwind: | |||
3523 | CLIENT_STACK_UNWIND (rename, frame, -1, op_errno, NULL, NULL, NULL,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3524, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
3524 | NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3524, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rename_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
3525 | ||||
3526 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3527 | ||||
3528 | return 0; | |||
3529 | } | |||
3530 | ||||
3531 | ||||
3532 | ||||
3533 | int32_t | |||
3534 | client3_3_link (call_frame_t *frame, xlator_t *this, | |||
3535 | void *data) | |||
3536 | { | |||
3537 | clnt_local_t *local = NULL((void*)0); | |||
3538 | clnt_conf_t *conf = NULL((void*)0); | |||
3539 | clnt_args_t *args = NULL((void*)0); | |||
3540 | gfs3_link_req req = {{0,},}; | |||
3541 | int ret = 0; | |||
3542 | int op_errno = ESTALE116; | |||
3543 | ||||
3544 | if (!frame || !this || !data) | |||
3545 | goto unwind; | |||
3546 | ||||
3547 | args = data; | |||
3548 | ||||
3549 | if (!(args->oldloc && args->oldloc->inode && args->newloc && | |||
3550 | args->newloc->parent)) | |||
3551 | goto unwind; | |||
3552 | ||||
3553 | if (!uuid_is_null (args->oldloc->inode->gfid)) | |||
3554 | memcpy (req.oldgfid, args->oldloc->inode->gfid, 16); | |||
3555 | else | |||
3556 | memcpy (req.oldgfid, args->oldloc->gfid, 16); | |||
3557 | ||||
3558 | if (!uuid_is_null (args->newloc->parent->gfid)) | |||
3559 | memcpy (req.newgfid, args->newloc->parent->gfid, 16); | |||
3560 | else | |||
3561 | memcpy (req.newgfid, args->newloc->pargfid, 16); | |||
3562 | ||||
3563 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.oldgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3565, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3564 | !uuid_is_null (*((uuid_t*)req.oldgfid)),do { if (!!uuid_is_null (*((uuid_t*)req.oldgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3565, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3565 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.oldgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3565, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3566 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.newgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3568, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3567 | !uuid_is_null (*((uuid_t*)req.newgfid)),do { if (!!uuid_is_null (*((uuid_t*)req.newgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3568, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3568 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.newgfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3568, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3569 | local = mem_get0 (this->local_pool); | |||
3570 | if (!local) { | |||
3571 | op_errno = ENOMEM12; | |||
3572 | goto unwind; | |||
3573 | } | |||
3574 | ||||
3575 | loc_copy (&local->loc, args->oldloc); | |||
3576 | loc_path (&local->loc, NULL((void*)0)); | |||
3577 | loc_copy (&local->loc2, args->newloc); | |||
3578 | loc_path (&local->loc2, NULL((void*)0)); | |||
3579 | frame->local = local; | |||
3580 | ||||
3581 | req.newbname = (char *)args->newloc->name; | |||
3582 | conf = this->private; | |||
3583 | ||||
3584 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3585, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3585 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3585, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3586 | ||||
3587 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3588 | GFS3_OP_LINK, client3_3_link_cbk, NULL((void*)0), | |||
3589 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
3590 | (xdrproc_t)xdr_gfs3_link_req); | |||
3591 | if (ret) { | |||
3592 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3592, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3593 | } | |||
3594 | ||||
3595 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3596 | ||||
3597 | return 0; | |||
3598 | unwind: | |||
3599 | CLIENT_STACK_UNWIND (link, frame, -1, op_errno, NULL, NULL, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3599, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_link_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3600 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3601 | ||||
3602 | return 0; | |||
3603 | } | |||
3604 | ||||
3605 | ||||
3606 | ||||
3607 | int32_t | |||
3608 | client3_3_mknod (call_frame_t *frame, xlator_t *this, | |||
3609 | void *data) | |||
3610 | { | |||
3611 | clnt_local_t *local = NULL((void*)0); | |||
3612 | clnt_conf_t *conf = NULL((void*)0); | |||
3613 | clnt_args_t *args = NULL((void*)0); | |||
3614 | gfs3_mknod_req req = {{0,},}; | |||
3615 | int ret = 0; | |||
3616 | int op_errno = ESTALE116; | |||
3617 | ||||
3618 | if (!frame || !this || !data) | |||
3619 | goto unwind; | |||
3620 | ||||
3621 | args = data; | |||
3622 | ||||
3623 | local = mem_get0 (this->local_pool); | |||
3624 | if (!local) { | |||
3625 | op_errno = ENOMEM12; | |||
3626 | goto unwind; | |||
3627 | } | |||
3628 | ||||
3629 | if (!(args->loc && args->loc->parent)) | |||
3630 | goto unwind; | |||
3631 | ||||
3632 | loc_copy (&local->loc, args->loc); | |||
3633 | loc_path (&local->loc, NULL((void*)0)); | |||
3634 | frame->local = local; | |||
3635 | ||||
3636 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
3637 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
3638 | else | |||
3639 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
3640 | ||||
3641 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3643, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3642 | !uuid_is_null (*((uuid_t*)req.pargfid)),do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3643, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3643 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3643, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3644 | req.bname = (char *)args->loc->name; | |||
3645 | req.mode = args->mode; | |||
3646 | req.dev = args->rdev; | |||
3647 | req.umask = args->umask; | |||
3648 | ||||
3649 | conf = this->private; | |||
3650 | ||||
3651 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3652, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3652 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3652, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3653 | ||||
3654 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3655 | GFS3_OP_MKNOD, client3_3_mknod_cbk, NULL((void*)0), | |||
3656 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3657 | NULL((void*)0), (xdrproc_t)xdr_gfs3_mknod_req); | |||
3658 | if (ret) { | |||
3659 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3659, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3660 | } | |||
3661 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3662 | ||||
3663 | return 0; | |||
3664 | unwind: | |||
3665 | CLIENT_STACK_UNWIND (mknod, frame, -1, op_errno, NULL, NULL, NULL,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3666, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
3666 | NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3666, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mknod_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3667 | ||||
3668 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3669 | ||||
3670 | return 0; | |||
3671 | } | |||
3672 | ||||
3673 | ||||
3674 | ||||
3675 | int32_t | |||
3676 | client3_3_mkdir (call_frame_t *frame, xlator_t *this, | |||
3677 | void *data) | |||
3678 | { | |||
3679 | clnt_local_t *local = NULL((void*)0); | |||
3680 | clnt_conf_t *conf = NULL((void*)0); | |||
3681 | clnt_args_t *args = NULL((void*)0); | |||
3682 | gfs3_mkdir_req req = {{0,},}; | |||
3683 | int ret = 0; | |||
3684 | int op_errno = ESTALE116; | |||
3685 | ||||
3686 | if (!frame || !this || !data) | |||
3687 | goto unwind; | |||
3688 | ||||
3689 | args = data; | |||
3690 | ||||
3691 | local = mem_get0 (this->local_pool); | |||
3692 | if (!local) { | |||
3693 | op_errno = ENOMEM12; | |||
3694 | goto unwind; | |||
3695 | } | |||
3696 | ||||
3697 | if (!(args->loc && args->loc->parent)) | |||
3698 | goto unwind; | |||
3699 | ||||
3700 | loc_copy (&local->loc, args->loc); | |||
3701 | loc_path (&local->loc, NULL((void*)0)); | |||
3702 | frame->local = local; | |||
3703 | ||||
3704 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
3705 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
3706 | else | |||
3707 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
3708 | ||||
3709 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3711, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3710 | !uuid_is_null (*((uuid_t*)req.pargfid)),do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3711, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3711 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3711, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3712 | ||||
3713 | req.bname = (char *)args->loc->name; | |||
3714 | req.mode = args->mode; | |||
3715 | req.umask = args->umask; | |||
3716 | ||||
3717 | conf = this->private; | |||
3718 | ||||
3719 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3720, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3720 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3720, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3721 | ||||
3722 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3723 | GFS3_OP_MKDIR, client3_3_mkdir_cbk, NULL((void*)0), | |||
3724 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3725 | NULL((void*)0), (xdrproc_t)xdr_gfs3_mkdir_req); | |||
3726 | if (ret) { | |||
3727 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3727, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3728 | } | |||
3729 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3730 | ||||
3731 | return 0; | |||
3732 | unwind: | |||
3733 | CLIENT_STACK_UNWIND (mkdir, frame, -1, op_errno, NULL, NULL, NULL,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3734, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0) | |||
3734 | NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3734, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_mkdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3735 | ||||
3736 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3737 | ||||
3738 | return 0; | |||
3739 | } | |||
3740 | ||||
3741 | ||||
3742 | int32_t | |||
3743 | client3_3_create (call_frame_t *frame, xlator_t *this, | |||
3744 | void *data) | |||
3745 | { | |||
3746 | clnt_local_t *local = NULL((void*)0); | |||
3747 | clnt_conf_t *conf = NULL((void*)0); | |||
3748 | clnt_args_t *args = NULL((void*)0); | |||
3749 | gfs3_create_req req = {{0,},}; | |||
3750 | int ret = 0; | |||
3751 | int op_errno = ESTALE116; | |||
3752 | ||||
3753 | if (!frame || !this || !data) | |||
3754 | goto unwind; | |||
3755 | ||||
3756 | args = data; | |||
3757 | ||||
3758 | local = mem_get0 (this->local_pool); | |||
3759 | if (!local) { | |||
3760 | op_errno = ENOMEM12; | |||
3761 | goto unwind; | |||
3762 | } | |||
3763 | if (!(args->loc && args->loc->parent)) | |||
3764 | goto unwind; | |||
3765 | ||||
3766 | local->fd = fd_ref (args->fd); | |||
3767 | local->flags = args->flags; | |||
3768 | ||||
3769 | loc_copy (&local->loc, args->loc); | |||
3770 | loc_path (&local->loc, NULL((void*)0)); | |||
3771 | frame->local = local; | |||
3772 | ||||
3773 | if (!uuid_is_null (args->loc->parent->gfid)) | |||
3774 | memcpy (req.pargfid, args->loc->parent->gfid, 16); | |||
3775 | else | |||
3776 | memcpy (req.pargfid, args->loc->pargfid, 16); | |||
3777 | ||||
3778 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3780, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3779 | !uuid_is_null (*((uuid_t*)req.pargfid)),do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3780, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3780 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.pargfid))) { do { if ( !(0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3780, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3781 | req.bname = (char *)args->loc->name; | |||
3782 | req.mode = args->mode; | |||
3783 | req.flags = gf_flags_from_flags (args->flags); | |||
3784 | req.umask = args->umask; | |||
3785 | ||||
3786 | conf = this->private; | |||
3787 | ||||
3788 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3789, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3789 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3789, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3790 | ||||
3791 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3792 | GFS3_OP_CREATE, client3_3_create_cbk, NULL((void*)0), | |||
3793 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
3794 | NULL((void*)0), (xdrproc_t)xdr_gfs3_create_req); | |||
3795 | if (ret) { | |||
3796 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3796, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3797 | } | |||
3798 | ||||
3799 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3800 | ||||
3801 | return 0; | |||
3802 | unwind: | |||
3803 | CLIENT_STACK_UNWIND (create, frame, -1, op_errno, NULL, NULL, NULL,do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3804, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0) | |||
3804 | NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3804, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_create_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ( (void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
3805 | ||||
3806 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3807 | ||||
3808 | return 0; | |||
3809 | } | |||
3810 | ||||
3811 | ||||
3812 | ||||
3813 | int32_t | |||
3814 | client3_3_open (call_frame_t *frame, xlator_t *this, | |||
3815 | void *data) | |||
3816 | { | |||
3817 | clnt_local_t *local = NULL((void*)0); | |||
3818 | clnt_conf_t *conf = NULL((void*)0); | |||
3819 | clnt_args_t *args = NULL((void*)0); | |||
3820 | gfs3_open_req req = {{0,},}; | |||
3821 | int ret = 0; | |||
3822 | int op_errno = ESTALE116; | |||
3823 | ||||
3824 | if (!frame || !this || !data) | |||
3825 | goto unwind; | |||
3826 | ||||
3827 | args = data; | |||
3828 | ||||
3829 | local = mem_get0 (this->local_pool); | |||
3830 | if (!local) { | |||
3831 | op_errno = ENOMEM12; | |||
3832 | goto unwind; | |||
3833 | } | |||
3834 | if (!(args->loc && args->loc->inode)) | |||
3835 | goto unwind; | |||
3836 | ||||
3837 | local->fd = fd_ref (args->fd); | |||
3838 | local->flags = args->flags; | |||
3839 | loc_copy (&local->loc, args->loc); | |||
3840 | loc_path (&local->loc, NULL((void*)0)); | |||
3841 | frame->local = local; | |||
3842 | ||||
3843 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
3844 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
3845 | else | |||
3846 | memcpy (req.gfid, args->loc->gfid, 16); | |||
3847 | ||||
3848 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3850, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3849 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3850, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
3850 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 3850, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
3851 | req.flags = gf_flags_from_flags (args->flags); | |||
3852 | ||||
3853 | conf = this->private; | |||
3854 | ||||
3855 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3856, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3856 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3856, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3857 | ||||
3858 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3859 | GFS3_OP_OPEN, client3_3_open_cbk, NULL((void*)0), | |||
3860 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
3861 | (xdrproc_t)xdr_gfs3_open_req); | |||
3862 | if (ret) { | |||
3863 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3863, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3864 | } | |||
3865 | ||||
3866 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3867 | ||||
3868 | return 0; | |||
3869 | unwind: | |||
3870 | CLIENT_STACK_UNWIND (open, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_open_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3870, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_open_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3871 | ||||
3872 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3873 | ||||
3874 | return 0; | |||
3875 | } | |||
3876 | ||||
3877 | ||||
3878 | ||||
3879 | int32_t | |||
3880 | client3_3_readv (call_frame_t *frame, xlator_t *this, | |||
3881 | void *data) | |||
3882 | { | |||
3883 | clnt_args_t *args = NULL((void*)0); | |||
3884 | int64_t remote_fd = -1; | |||
3885 | clnt_conf_t *conf = NULL((void*)0); | |||
3886 | clnt_local_t *local = NULL((void*)0); | |||
3887 | int op_errno = ESTALE116; | |||
3888 | gfs3_read_req req = {{0,},}; | |||
3889 | int ret = 0; | |||
3890 | struct iovec rsp_vec = {0, }; | |||
3891 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
3892 | struct iobref *rsp_iobref = NULL((void*)0); | |||
3893 | ||||
3894 | if (!frame || !this || !data) | |||
3895 | goto unwind; | |||
3896 | ||||
3897 | args = data; | |||
3898 | conf = this->private; | |||
3899 | ||||
3900 | CLIENT_GET_REMOTE_FD (this, args->fd, FALLBACK_TO_ANON_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 3901, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
3901 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 3901, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
3902 | ret = client_fd_fop_prepare_local (frame, args->fd, remote_fd); | |||
3903 | if (ret) { | |||
3904 | op_errno = -ret; | |||
3905 | goto unwind; | |||
3906 | } | |||
3907 | local = frame->local; | |||
3908 | ||||
3909 | req.size = args->size; | |||
3910 | req.offset = args->offset; | |||
3911 | req.fd = remote_fd; | |||
3912 | req.flag = args->flags; | |||
3913 | ||||
3914 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
3915 | ||||
3916 | rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, args->size); | |||
3917 | if (rsp_iobuf == NULL((void*)0)) { | |||
3918 | op_errno = ENOMEM12; | |||
3919 | goto unwind; | |||
3920 | } | |||
3921 | ||||
3922 | rsp_iobref = iobref_new (); | |||
3923 | if (rsp_iobref == NULL((void*)0)) { | |||
3924 | op_errno = ENOMEM12; | |||
3925 | goto unwind; | |||
3926 | } | |||
3927 | ||||
3928 | iobref_add (rsp_iobref, rsp_iobuf); | |||
3929 | iobuf_unref (rsp_iobuf); | |||
3930 | ||||
3931 | rsp_vec.iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
3932 | rsp_vec.iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
3933 | ||||
3934 | rsp_iobuf = NULL((void*)0); | |||
3935 | ||||
3936 | if (args->size > rsp_vec.iov_len) { | |||
3937 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3940, GF_LOG_WARNING, "read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0) | |||
3938 | "read-size (%lu) is bigger than iobuf size (%lu)",do { do { if (0) printf ("read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3940, GF_LOG_WARNING, "read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0) | |||
3939 | (unsigned long)args->size,do { do { if (0) printf ("read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3940, GF_LOG_WARNING, "read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0) | |||
3940 | (unsigned long)rsp_vec.iov_len)do { do { if (0) printf ("read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3940, GF_LOG_WARNING, "read-size (%lu) is bigger than iobuf size (%lu)" , (unsigned long)args->size, (unsigned long)rsp_vec.iov_len ); } while (0); | |||
3941 | op_errno = EINVAL22; | |||
3942 | goto unwind; | |||
3943 | } | |||
3944 | ||||
3945 | local->iobref = rsp_iobref; | |||
3946 | rsp_iobref = NULL((void*)0); | |||
3947 | ||||
3948 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3949, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
3949 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 3949, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
3950 | ||||
3951 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
3952 | GFS3_OP_READ, client3_3_readv_cbk, NULL((void*)0), | |||
3953 | NULL((void*)0), 0, &rsp_vec, 1, | |||
3954 | local->iobref, | |||
3955 | (xdrproc_t)xdr_gfs3_read_req); | |||
3956 | if (ret) { | |||
3957 | //unwind is done in the cbk | |||
3958 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 3958, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
3959 | } | |||
3960 | ||||
3961 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3962 | ||||
3963 | return 0; | |||
3964 | unwind: | |||
3965 | if (rsp_iobuf) | |||
3966 | iobuf_unref (rsp_iobuf); | |||
3967 | ||||
3968 | if (rsp_iobref) | |||
3969 | iobref_unref (rsp_iobref); | |||
3970 | ||||
3971 | CLIENT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readv_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 3971, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readv_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), 0, ((void*)0), ((void*)0), ((void*)0) ); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
3972 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
3973 | ||||
3974 | return 0; | |||
3975 | } | |||
3976 | ||||
3977 | ||||
3978 | int32_t | |||
3979 | client3_3_writev (call_frame_t *frame, xlator_t *this, void *data) | |||
3980 | { | |||
3981 | clnt_args_t *args = NULL((void*)0); | |||
3982 | int64_t remote_fd = -1; | |||
3983 | clnt_conf_t *conf = NULL((void*)0); | |||
3984 | gfs3_write_req req = {{0,},}; | |||
3985 | int op_errno = ESTALE116; | |||
3986 | int ret = 0; | |||
3987 | ||||
3988 | if (!frame || !this || !data) | |||
3989 | goto unwind; | |||
3990 | ||||
3991 | args = data; | |||
3992 | conf = this->private; | |||
3993 | ||||
3994 | CLIENT_GET_REMOTE_FD (this, args->fd, FALLBACK_TO_ANON_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 3995, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
3995 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 3995, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
3996 | ret = client_fd_fop_prepare_local (frame, args->fd, remote_fd); | |||
3997 | if (ret) { | |||
3998 | op_errno = -ret; | |||
3999 | goto unwind; | |||
4000 | } | |||
4001 | ||||
4002 | req.size = args->size; | |||
4003 | req.offset = args->offset; | |||
4004 | req.fd = remote_fd; | |||
4005 | req.flag = args->flags; | |||
4006 | ||||
4007 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4008 | ||||
4009 | #ifdef GF_TESTING_IO_XDATA | |||
4010 | if (!args->xdata) | |||
4011 | args->xdata = dict_new (); | |||
4012 | ||||
4013 | ret = dict_set_str (args->xdata, "testing-the-xdata-key", | |||
4014 | "testing-the-xdata-value"); | |||
4015 | #endif | |||
4016 | ||||
4017 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4018, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4018 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4018, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4019 | ||||
4020 | ret = client_submit_vec_request (this, &req, frame, conf->fops, | |||
4021 | GFS3_OP_WRITE, client3_3_writev_cbk, | |||
4022 | args->vector, args->count, | |||
4023 | args->iobref, | |||
4024 | (xdrproc_t)xdr_gfs3_write_req); | |||
4025 | if (ret) { | |||
4026 | /* | |||
4027 | * If the lower layers fail to submit a request, they'll also | |||
4028 | * do the unwind for us (see rpc_clnt_submit), so don't unwind | |||
4029 | * here in such cases. | |||
4030 | */ | |||
4031 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4031, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4032 | } | |||
4033 | ||||
4034 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4035 | ||||
4036 | return 0; | |||
4037 | ||||
4038 | unwind: | |||
4039 | CLIENT_STACK_UNWIND (writev, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4039, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_writev_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4040 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4041 | ||||
4042 | return 0; | |||
4043 | } | |||
4044 | ||||
4045 | ||||
4046 | int32_t | |||
4047 | client3_3_flush (call_frame_t *frame, xlator_t *this, | |||
4048 | void *data) | |||
4049 | { | |||
4050 | clnt_args_t *args = NULL((void*)0); | |||
4051 | gfs3_flush_req req = {{0,},}; | |||
4052 | int64_t remote_fd = -1; | |||
4053 | clnt_conf_t *conf = NULL((void*)0); | |||
4054 | clnt_local_t *local = NULL((void*)0); | |||
4055 | int op_errno = ESTALE116; | |||
4056 | int ret = 0; | |||
4057 | ||||
4058 | if (!frame || !this || !data) | |||
4059 | goto unwind; | |||
4060 | ||||
4061 | args = data; | |||
4062 | conf = this->private; | |||
4063 | ||||
4064 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4065, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4065 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4065, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4066 | ||||
4067 | conf = this->private; | |||
4068 | ||||
4069 | local = mem_get0 (this->local_pool); | |||
4070 | if (!local) { | |||
4071 | op_errno = ENOMEM12; | |||
4072 | goto unwind; | |||
4073 | } | |||
4074 | ||||
4075 | local->fd = fd_ref (args->fd); | |||
4076 | local->owner = frame->root->lk_owner; | |||
4077 | frame->local = local; | |||
4078 | ||||
4079 | req.fd = remote_fd; | |||
4080 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4081 | ||||
4082 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4083, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4083 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4083, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4084 | ||||
4085 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4086 | GFS3_OP_FLUSH, client3_3_flush_cbk, NULL((void*)0), | |||
4087 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
4088 | NULL((void*)0), (xdrproc_t)xdr_gfs3_flush_req); | |||
4089 | if (ret) { | |||
4090 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4090, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4091 | } | |||
4092 | ||||
4093 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4094 | ||||
4095 | ||||
4096 | return 0; | |||
4097 | ||||
4098 | unwind: | |||
4099 | CLIENT_STACK_UNWIND (flush, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_flush_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4099, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_flush_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
4100 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4101 | ||||
4102 | return 0; | |||
4103 | } | |||
4104 | ||||
4105 | ||||
4106 | ||||
4107 | int32_t | |||
4108 | client3_3_fsync (call_frame_t *frame, xlator_t *this, | |||
4109 | void *data) | |||
4110 | { | |||
4111 | clnt_args_t *args = NULL((void*)0); | |||
4112 | gfs3_fsync_req req = {{0,},}; | |||
4113 | int64_t remote_fd = -1; | |||
4114 | clnt_conf_t *conf = NULL((void*)0); | |||
4115 | int op_errno = 0; | |||
4116 | int ret = 0; | |||
4117 | ||||
4118 | if (!frame || !this || !data) | |||
4119 | goto unwind; | |||
4120 | ||||
4121 | args = data; | |||
4122 | conf = this->private; | |||
4123 | ||||
4124 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4125, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4125 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4125, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4126 | ||||
4127 | req.fd = remote_fd; | |||
4128 | req.data = args->flags; | |||
4129 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4130 | ||||
4131 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4132, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4132 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4132, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4133 | ||||
4134 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4135 | GFS3_OP_FSYNC, client3_3_fsync_cbk, NULL((void*)0), | |||
4136 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
4137 | NULL((void*)0), (xdrproc_t)xdr_gfs3_fsync_req); | |||
4138 | if (ret) { | |||
4139 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4139, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4140 | ||||
4141 | } | |||
4142 | ||||
4143 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4144 | ||||
4145 | return 0; | |||
4146 | ||||
4147 | unwind: | |||
4148 | CLIENT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsync_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4148, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsync_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4149 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4150 | ||||
4151 | return 0; | |||
4152 | } | |||
4153 | ||||
4154 | ||||
4155 | ||||
4156 | int32_t | |||
4157 | client3_3_fstat (call_frame_t *frame, xlator_t *this, | |||
4158 | void *data) | |||
4159 | { | |||
4160 | clnt_args_t *args = NULL((void*)0); | |||
4161 | gfs3_fstat_req req = {{0,},}; | |||
4162 | int64_t remote_fd = -1; | |||
4163 | clnt_conf_t *conf = NULL((void*)0); | |||
4164 | int op_errno = ESTALE116; | |||
4165 | int ret = 0; | |||
4166 | ||||
4167 | if (!frame || !this || !data) | |||
4168 | goto unwind; | |||
4169 | ||||
4170 | args = data; | |||
4171 | conf = this->private; | |||
4172 | ||||
4173 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4174, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4174 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4174, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4175 | ||||
4176 | req.fd = remote_fd; | |||
4177 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4178 | ||||
4179 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4180, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4180 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4180, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4181 | ||||
4182 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4183 | GFS3_OP_FSTAT, client3_3_fstat_cbk, NULL((void*)0), | |||
4184 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
4185 | NULL((void*)0), (xdrproc_t)xdr_gfs3_fstat_req); | |||
4186 | if (ret) { | |||
4187 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4187, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4188 | } | |||
4189 | ||||
4190 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4191 | ||||
4192 | return 0; | |||
4193 | ||||
4194 | unwind: | |||
4195 | CLIENT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fstat_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4195, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fstat_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4196 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4197 | ||||
4198 | return 0; | |||
4199 | } | |||
4200 | ||||
4201 | ||||
4202 | ||||
4203 | int32_t | |||
4204 | client3_3_opendir (call_frame_t *frame, xlator_t *this, | |||
4205 | void *data) | |||
4206 | { | |||
4207 | clnt_local_t *local = NULL((void*)0); | |||
4208 | clnt_conf_t *conf = NULL((void*)0); | |||
4209 | clnt_args_t *args = NULL((void*)0); | |||
4210 | gfs3_opendir_req req = {{0,},}; | |||
4211 | int ret = 0; | |||
4212 | int op_errno = ESTALE116; | |||
4213 | ||||
4214 | if (!frame || !this || !data) | |||
4215 | goto unwind; | |||
4216 | ||||
4217 | args = data; | |||
4218 | ||||
4219 | local = mem_get0 (this->local_pool); | |||
4220 | if (!local) { | |||
4221 | op_errno = ENOMEM12; | |||
4222 | goto unwind; | |||
4223 | } | |||
4224 | if (!(args->loc && args->loc->inode)) | |||
4225 | goto unwind; | |||
4226 | ||||
4227 | local->fd = fd_ref (args->fd); | |||
4228 | loc_copy (&local->loc, args->loc); | |||
4229 | loc_path (&local->loc, NULL((void*)0)); | |||
4230 | frame->local = local; | |||
4231 | ||||
4232 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
4233 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
4234 | else | |||
4235 | memcpy (req.gfid, args->loc->gfid, 16); | |||
4236 | ||||
4237 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4239, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4238 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4239, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4239 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4239, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
4240 | ||||
4241 | conf = this->private; | |||
4242 | ||||
4243 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4244, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4244 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4244, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4245 | ||||
4246 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4247 | GFS3_OP_OPENDIR, client3_3_opendir_cbk, | |||
4248 | NULL((void*)0), NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
4249 | (xdrproc_t)xdr_gfs3_opendir_req); | |||
4250 | if (ret) { | |||
4251 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4251, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4252 | } | |||
4253 | ||||
4254 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4255 | ||||
4256 | return 0; | |||
4257 | ||||
4258 | unwind: | |||
4259 | CLIENT_STACK_UNWIND (opendir, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_opendir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4259, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_opendir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4260 | ||||
4261 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4262 | ||||
4263 | return 0; | |||
4264 | } | |||
4265 | ||||
4266 | ||||
4267 | ||||
4268 | int32_t | |||
4269 | client3_3_fsyncdir (call_frame_t *frame, xlator_t *this, void *data) | |||
4270 | { | |||
4271 | clnt_args_t *args = NULL((void*)0); | |||
4272 | int64_t remote_fd = -1; | |||
4273 | clnt_conf_t *conf = NULL((void*)0); | |||
4274 | gfs3_fsyncdir_req req = {{0,},}; | |||
4275 | int ret = 0; | |||
4276 | int32_t op_errno = ESTALE116; | |||
4277 | ||||
4278 | if (!frame || !this || !data) | |||
4279 | goto unwind; | |||
4280 | ||||
4281 | args = data; | |||
4282 | conf = this->private; | |||
4283 | ||||
4284 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4285, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4285 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4285, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4286 | ||||
4287 | req.fd = remote_fd; | |||
4288 | req.data = args->flags; | |||
4289 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4290 | ||||
4291 | conf = this->private; | |||
4292 | ||||
4293 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4294, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4294 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4294, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4295 | ||||
4296 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4297 | GFS3_OP_FSYNCDIR, client3_3_fsyncdir_cbk, | |||
4298 | NULL((void*)0), NULL((void*)0), 0, | |||
4299 | NULL((void*)0), 0, NULL((void*)0), | |||
4300 | (xdrproc_t)xdr_gfs3_fsyncdir_req); | |||
4301 | if (ret) { | |||
4302 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4302, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4303 | } | |||
4304 | ||||
4305 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4306 | ||||
4307 | return 0; | |||
4308 | ||||
4309 | unwind: | |||
4310 | CLIENT_STACK_UNWIND (fsyncdir, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsyncdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4310, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsyncdir_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4311 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4312 | ||||
4313 | return 0; | |||
4314 | } | |||
4315 | ||||
4316 | ||||
4317 | ||||
4318 | int32_t | |||
4319 | client3_3_statfs (call_frame_t *frame, xlator_t *this, | |||
4320 | void *data) | |||
4321 | { | |||
4322 | clnt_conf_t *conf = NULL((void*)0); | |||
4323 | clnt_args_t *args = NULL((void*)0); | |||
4324 | gfs3_statfs_req req = {{0,},}; | |||
4325 | int ret = 0; | |||
4326 | int op_errno = ESTALE116; | |||
4327 | ||||
4328 | if (!frame || !this || !data) | |||
4329 | goto unwind; | |||
4330 | ||||
4331 | args = data; | |||
4332 | ||||
4333 | if (!args->loc) | |||
4334 | goto unwind; | |||
4335 | ||||
4336 | if (args->loc->inode) { | |||
4337 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
4338 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
4339 | else | |||
4340 | memcpy (req.gfid, args->loc->gfid, 16); | |||
4341 | } else | |||
4342 | req.gfid[15] = 1; | |||
4343 | ||||
4344 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4346, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4345 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4346, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4346 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4346, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
4347 | ||||
4348 | conf = this->private; | |||
4349 | ||||
4350 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4351, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4351 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4351, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4352 | ||||
4353 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4354 | GFS3_OP_STATFS, client3_3_statfs_cbk, NULL((void*)0), | |||
4355 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
4356 | NULL((void*)0), (xdrproc_t)xdr_gfs3_statfs_req); | |||
4357 | if (ret) { | |||
4358 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4358, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4359 | } | |||
4360 | ||||
4361 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4362 | ||||
4363 | return 0; | |||
4364 | ||||
4365 | unwind: | |||
4366 | CLIENT_STACK_UNWIND (statfs, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_statfs_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4366, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_statfs_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4367 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4368 | ||||
4369 | return 0; | |||
4370 | } | |||
4371 | ||||
4372 | ||||
4373 | ||||
4374 | int32_t | |||
4375 | client3_3_setxattr (call_frame_t *frame, xlator_t *this, | |||
4376 | void *data) | |||
4377 | { | |||
4378 | clnt_conf_t *conf = NULL((void*)0); | |||
4379 | clnt_args_t *args = NULL((void*)0); | |||
4380 | gfs3_setxattr_req req = {{0,},}; | |||
4381 | int ret = 0; | |||
4382 | int op_errno = ESTALE116; | |||
4383 | ||||
4384 | if (!frame || !this || !data) | |||
4385 | goto unwind; | |||
4386 | ||||
4387 | args = data; | |||
4388 | ||||
4389 | if (!(args->loc && args->loc->inode)) | |||
4390 | goto unwind; | |||
4391 | ||||
4392 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
4393 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
4394 | else | |||
4395 | memcpy (req.gfid, args->loc->gfid, 16); | |||
4396 | ||||
4397 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4399, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4398 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4399, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4399 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4399, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
4400 | if (args->xattr) { | |||
4401 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4404, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4402 | (&req.dict.dict_val),do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4404, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4403 | req.dict.dict_len,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4404, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4404 | op_errno, unwind)do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4404, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4405 | } | |||
4406 | ||||
4407 | req.flags = args->flags; | |||
4408 | ||||
4409 | conf = this->private; | |||
4410 | ||||
4411 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4412, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4412 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4412, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4413 | ||||
4414 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4415 | GFS3_OP_SETXATTR, client3_3_setxattr_cbk, | |||
4416 | NULL((void*)0), NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
4417 | (xdrproc_t)xdr_gfs3_setxattr_req); | |||
4418 | if (ret) { | |||
4419 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4419, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4420 | } | |||
4421 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4422 | ||||
4423 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4424 | ||||
4425 | return 0; | |||
4426 | unwind: | |||
4427 | CLIENT_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4427, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4428 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4429 | ||||
4430 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4431 | ||||
4432 | return 0; | |||
4433 | } | |||
4434 | ||||
4435 | ||||
4436 | ||||
4437 | int32_t | |||
4438 | client3_3_fsetxattr (call_frame_t *frame, xlator_t *this, | |||
4439 | void *data) | |||
4440 | { | |||
4441 | clnt_args_t *args = NULL((void*)0); | |||
4442 | int64_t remote_fd = -1; | |||
4443 | clnt_conf_t *conf = NULL((void*)0); | |||
4444 | gfs3_fsetxattr_req req = {{0,},}; | |||
4445 | int op_errno = ESTALE116; | |||
4446 | int ret = 0; | |||
4447 | ||||
4448 | if (!frame || !this || !data) | |||
4449 | goto unwind; | |||
4450 | ||||
4451 | args = data; | |||
4452 | conf = this->private; | |||
4453 | ||||
4454 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4455, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4455 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4455, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4456 | ||||
4457 | req.fd = remote_fd; | |||
4458 | req.flags = args->flags; | |||
4459 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4460 | ||||
4461 | if (args->xattr) { | |||
4462 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4465, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4463 | (&req.dict.dict_val),do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4465, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4464 | req.dict.dict_len,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4465, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4465 | op_errno, unwind)do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4465, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4466 | } | |||
4467 | ||||
4468 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4469, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4469 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4469, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4470 | ||||
4471 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4472 | GFS3_OP_FSETXATTR, client3_3_fsetxattr_cbk, | |||
4473 | NULL((void*)0), NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
4474 | (xdrproc_t)xdr_gfs3_fsetxattr_req); | |||
4475 | if (ret) { | |||
4476 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4476, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4477 | } | |||
4478 | ||||
4479 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4480 | ||||
4481 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4482 | ||||
4483 | return 0; | |||
4484 | unwind: | |||
4485 | CLIENT_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4485, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsetxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4486 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4487 | ||||
4488 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4489 | ||||
4490 | return 0; | |||
4491 | } | |||
4492 | ||||
4493 | ||||
4494 | ||||
4495 | ||||
4496 | int32_t | |||
4497 | client3_3_fgetxattr (call_frame_t *frame, xlator_t *this, | |||
4498 | void *data) | |||
4499 | { | |||
4500 | clnt_args_t *args = NULL((void*)0); | |||
4501 | int64_t remote_fd = -1; | |||
4502 | clnt_conf_t *conf = NULL((void*)0); | |||
4503 | gfs3_fgetxattr_req req = {{0,},}; | |||
4504 | int op_errno = ESTALE116; | |||
4505 | int ret = 0; | |||
4506 | int count = 0; | |||
4507 | clnt_local_t *local = NULL((void*)0); | |||
4508 | struct iobref *rsp_iobref = NULL((void*)0); | |||
4509 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
4510 | struct iovec *rsphdr = NULL((void*)0); | |||
4511 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
4512 | ||||
4513 | if (!frame || !this || !data) | |||
4514 | goto unwind; | |||
4515 | ||||
4516 | args = data; | |||
4517 | conf = this->private; | |||
4518 | ||||
4519 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4520, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4520 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4520, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4521 | ||||
4522 | local = mem_get0 (this->local_pool); | |||
4523 | if (!local) { | |||
4524 | op_errno = ENOMEM12; | |||
4525 | goto unwind; | |||
4526 | } | |||
4527 | frame->local = local; | |||
4528 | ||||
4529 | rsp_iobref = iobref_new (); | |||
4530 | if (rsp_iobref == NULL((void*)0)) { | |||
4531 | op_errno = ENOMEM12; | |||
4532 | goto unwind; | |||
4533 | } | |||
4534 | ||||
4535 | /* TODO: what is the size we should send ? */ | |||
4536 | rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB1024ULL); | |||
4537 | if (rsp_iobuf == NULL((void*)0)) { | |||
4538 | op_errno = ENOMEM12; | |||
4539 | goto unwind; | |||
4540 | } | |||
4541 | ||||
4542 | iobref_add (rsp_iobref, rsp_iobuf); | |||
4543 | iobuf_unref (rsp_iobuf); | |||
4544 | ||||
4545 | rsphdr = &vector[0]; | |||
4546 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
4547 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size);; | |||
4548 | count = 1; | |||
4549 | local->iobref = rsp_iobref; | |||
4550 | rsp_iobuf = NULL((void*)0); | |||
4551 | rsp_iobref = NULL((void*)0); | |||
4552 | ||||
4553 | req.namelen = 1; /* Use it as a flag */ | |||
4554 | req.fd = remote_fd; | |||
4555 | req.name = (char *)args->name; | |||
4556 | if (!req.name) { | |||
4557 | req.name = ""; | |||
4558 | req.namelen = 0; | |||
4559 | } | |||
4560 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4561 | ||||
4562 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4563, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4563 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4563, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4564 | ||||
4565 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4566 | GFS3_OP_FGETXATTR, | |||
4567 | client3_3_fgetxattr_cbk, NULL((void*)0), | |||
4568 | rsphdr, count, | |||
4569 | NULL((void*)0), 0, local->iobref, | |||
4570 | (xdrproc_t)xdr_gfs3_fgetxattr_req); | |||
4571 | if (ret) { | |||
4572 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4572, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4573 | } | |||
4574 | ||||
4575 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4576 | ||||
4577 | if (rsp_iobuf) | |||
4578 | iobuf_unref (rsp_iobuf); | |||
4579 | ||||
4580 | if (rsp_iobref) | |||
4581 | iobref_unref (rsp_iobref); | |||
4582 | ||||
4583 | return 0; | |||
4584 | unwind: | |||
4585 | CLIENT_STACK_UNWIND (fgetxattr, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fgetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4585, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fgetxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4586 | ||||
4587 | if (rsp_iobuf) | |||
4588 | iobuf_unref (rsp_iobuf); | |||
4589 | ||||
4590 | if (rsp_iobref) | |||
4591 | iobref_unref (rsp_iobref); | |||
4592 | ||||
4593 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4594 | ||||
4595 | return 0; | |||
4596 | } | |||
4597 | ||||
4598 | ||||
4599 | ||||
4600 | int32_t | |||
4601 | client3_3_getxattr (call_frame_t *frame, xlator_t *this, | |||
4602 | void *data) | |||
4603 | { | |||
4604 | clnt_conf_t *conf = NULL((void*)0); | |||
4605 | clnt_args_t *args = NULL((void*)0); | |||
4606 | gfs3_getxattr_req req = {{0,},}; | |||
4607 | dict_t *dict = NULL((void*)0); | |||
4608 | int ret = 0; | |||
4609 | int32_t op_ret = -1; | |||
4610 | int op_errno = ESTALE116; | |||
4611 | int count = 0; | |||
4612 | clnt_local_t *local = NULL((void*)0); | |||
4613 | struct iobref *rsp_iobref = NULL((void*)0); | |||
4614 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
4615 | struct iovec *rsphdr = NULL((void*)0); | |||
4616 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
4617 | ||||
4618 | if (!frame || !this || !data) { | |||
4619 | op_errno = 0; | |||
4620 | goto unwind; | |||
4621 | } | |||
4622 | args = data; | |||
4623 | ||||
4624 | if (!args->loc) { | |||
4625 | op_errno = EINVAL22; | |||
4626 | goto unwind; | |||
4627 | } | |||
4628 | ||||
4629 | local = mem_get0 (this->local_pool); | |||
4630 | if (!local) { | |||
4631 | op_errno = ENOMEM12; | |||
4632 | goto unwind; | |||
4633 | } | |||
4634 | ||||
4635 | loc_copy (&local->loc, args->loc); | |||
4636 | loc_path (&local->loc, NULL((void*)0)); | |||
4637 | if (args->name) | |||
4638 | local->name = gf_strdup (args->name); | |||
4639 | ||||
4640 | frame->local = local; | |||
4641 | ||||
4642 | rsp_iobref = iobref_new (); | |||
4643 | if (rsp_iobref == NULL((void*)0)) { | |||
4644 | op_errno = ENOMEM12; | |||
4645 | goto unwind; | |||
4646 | } | |||
4647 | ||||
4648 | /* TODO: what is the size we should send ? */ | |||
4649 | rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB1024ULL); | |||
4650 | if (rsp_iobuf == NULL((void*)0)) { | |||
4651 | op_errno = ENOMEM12; | |||
4652 | goto unwind; | |||
4653 | } | |||
4654 | ||||
4655 | iobref_add (rsp_iobref, rsp_iobuf); | |||
4656 | iobuf_unref (rsp_iobuf); | |||
4657 | ||||
4658 | rsphdr = &vector[0]; | |||
4659 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
4660 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
4661 | count = 1; | |||
4662 | local->iobref = rsp_iobref; | |||
4663 | rsp_iobuf = NULL((void*)0); | |||
4664 | rsp_iobref = NULL((void*)0); | |||
4665 | ||||
4666 | if (args->loc->inode && !uuid_is_null (args->loc->inode->gfid)) | |||
4667 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
4668 | else | |||
4669 | memcpy (req.gfid, args->loc->gfid, 16); | |||
4670 | ||||
4671 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4673, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4672 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4673, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4673 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4673, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
4674 | req.namelen = 1; /* Use it as a flag */ | |||
4675 | ||||
4676 | req.name = (char *)args->name; | |||
4677 | if (!req.name) { | |||
4678 | req.name = ""; | |||
4679 | req.namelen = 0; | |||
4680 | } | |||
4681 | ||||
4682 | conf = this->private; | |||
4683 | ||||
4684 | if (args && args->name) { | |||
4685 | if (is_client_dump_locks_cmd ((char *)args->name)) { | |||
4686 | dict = dict_new (); | |||
4687 | ret = client_dump_locks ((char *)args->name, | |||
4688 | args->loc->inode, | |||
4689 | dict); | |||
4690 | if (ret) { | |||
4691 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Client dump locks failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4692, GF_LOG_WARNING, "Client dump locks failed"); } while ( 0) | |||
4692 | "Client dump locks failed")do { do { if (0) printf ("Client dump locks failed"); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4692, GF_LOG_WARNING, "Client dump locks failed"); } while ( 0); | |||
4693 | op_errno = EINVAL22; | |||
4694 | } | |||
4695 | ||||
4696 | GF_ASSERT (dict)do { if (!(dict)) { do { do { if (0) printf ("Assertion failed: " "dict"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c" , __FUNCTION__, 4696, GF_LOG_ERROR, "Assertion failed: " "dict" ); } while (0); } } while (0); | |||
4697 | op_ret = 0; | |||
4698 | op_errno = 0; | |||
4699 | goto unwind; | |||
4700 | } | |||
4701 | } | |||
4702 | ||||
4703 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4704, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4704 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4704, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4705 | ||||
4706 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4707 | GFS3_OP_GETXATTR, | |||
4708 | client3_3_getxattr_cbk, NULL((void*)0), | |||
4709 | rsphdr, count, | |||
4710 | NULL((void*)0), 0, local->iobref, | |||
4711 | (xdrproc_t)xdr_gfs3_getxattr_req); | |||
4712 | if (ret) { | |||
4713 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4713, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4714 | } | |||
4715 | ||||
4716 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4717 | ||||
4718 | if (rsp_iobuf) | |||
4719 | iobuf_unref (rsp_iobuf); | |||
4720 | ||||
4721 | if (rsp_iobref) | |||
4722 | iobref_unref (rsp_iobref); | |||
4723 | ||||
4724 | return 0; | |||
4725 | unwind: | |||
4726 | if (rsp_iobuf) | |||
4727 | iobuf_unref (rsp_iobuf); | |||
4728 | ||||
4729 | if (rsp_iobref) | |||
4730 | iobref_unref (rsp_iobref); | |||
4731 | ||||
4732 | CLIENT_STACK_UNWIND (getxattr, frame, op_ret, op_errno, dict, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4732, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_getxattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, op_ret, op_errno, dict, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4733 | ||||
4734 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4735 | ||||
4736 | return 0; | |||
4737 | } | |||
4738 | ||||
4739 | ||||
4740 | ||||
4741 | int32_t | |||
4742 | client3_3_xattrop (call_frame_t *frame, xlator_t *this, | |||
4743 | void *data) | |||
4744 | { | |||
4745 | clnt_conf_t *conf = NULL((void*)0); | |||
4746 | clnt_args_t *args = NULL((void*)0); | |||
4747 | gfs3_xattrop_req req = {{0,},}; | |||
4748 | int ret = 0; | |||
4749 | int op_errno = ESTALE116; | |||
4750 | int count = 0; | |||
4751 | clnt_local_t *local = NULL((void*)0); | |||
4752 | struct iobref *rsp_iobref = NULL((void*)0); | |||
4753 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
4754 | struct iovec *rsphdr = NULL((void*)0); | |||
4755 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
4756 | ||||
4757 | if (!frame || !this || !data) | |||
4758 | goto unwind; | |||
4759 | ||||
4760 | args = data; | |||
4761 | ||||
4762 | if (!(args->loc && args->loc->inode)) | |||
4763 | goto unwind; | |||
4764 | ||||
4765 | local = mem_get0 (this->local_pool); | |||
4766 | if (!local) { | |||
4767 | op_errno = ENOMEM12; | |||
4768 | goto unwind; | |||
4769 | } | |||
4770 | frame->local = local; | |||
4771 | ||||
4772 | rsp_iobref = iobref_new (); | |||
4773 | if (rsp_iobref == NULL((void*)0)) { | |||
4774 | op_errno = ENOMEM12; | |||
4775 | goto unwind; | |||
4776 | } | |||
4777 | ||||
4778 | /* TODO: what is the size we should send ? */ | |||
4779 | rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB1024ULL); | |||
4780 | if (rsp_iobuf == NULL((void*)0)) { | |||
4781 | op_errno = ENOMEM12; | |||
4782 | goto unwind; | |||
4783 | } | |||
4784 | ||||
4785 | iobref_add (rsp_iobref, rsp_iobuf); | |||
4786 | iobuf_unref (rsp_iobuf); | |||
4787 | ||||
4788 | rsphdr = &vector[0]; | |||
4789 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
4790 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
4791 | count = 1; | |||
4792 | local->iobref = rsp_iobref; | |||
4793 | rsp_iobuf = NULL((void*)0); | |||
4794 | rsp_iobref = NULL((void*)0); | |||
4795 | ||||
4796 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
4797 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
4798 | else | |||
4799 | memcpy (req.gfid, args->loc->gfid, 16); | |||
4800 | ||||
4801 | loc_copy (&local->loc, args->loc); | |||
4802 | loc_path (&local->loc, NULL((void*)0)); | |||
4803 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4805, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4804 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4805, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4805 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4805, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
4806 | if (args->xattr) { | |||
4807 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4810, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4808 | (&req.dict.dict_val),do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4810, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4809 | req.dict.dict_len,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4810, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4810 | op_errno, unwind)do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4810, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4811 | } | |||
4812 | ||||
4813 | req.flags = args->flags; | |||
4814 | ||||
4815 | conf = this->private; | |||
4816 | ||||
4817 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4818, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4818 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4818, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4819 | ||||
4820 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4821 | GFS3_OP_XATTROP, | |||
4822 | client3_3_xattrop_cbk, NULL((void*)0), | |||
4823 | rsphdr, count, | |||
4824 | NULL((void*)0), 0, local->iobref, | |||
4825 | (xdrproc_t)xdr_gfs3_xattrop_req); | |||
4826 | if (ret) { | |||
4827 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4827, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4828 | } | |||
4829 | ||||
4830 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4831 | ||||
4832 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4833 | ||||
4834 | if (rsp_iobuf) | |||
4835 | iobuf_unref (rsp_iobuf); | |||
4836 | ||||
4837 | if (rsp_iobref) | |||
4838 | iobref_unref (rsp_iobref); | |||
4839 | ||||
4840 | return 0; | |||
4841 | unwind: | |||
4842 | CLIENT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_xattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4842, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_xattrop_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4843 | ||||
4844 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4845 | ||||
4846 | if (rsp_iobuf) | |||
4847 | iobuf_unref (rsp_iobuf); | |||
4848 | ||||
4849 | if (rsp_iobref) | |||
4850 | iobref_unref (rsp_iobref); | |||
4851 | ||||
4852 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4853 | ||||
4854 | return 0; | |||
4855 | } | |||
4856 | ||||
4857 | ||||
4858 | ||||
4859 | int32_t | |||
4860 | client3_3_fxattrop (call_frame_t *frame, xlator_t *this, | |||
4861 | void *data) | |||
4862 | { | |||
4863 | clnt_args_t *args = NULL((void*)0); | |||
4864 | int64_t remote_fd = -1; | |||
4865 | clnt_conf_t *conf = NULL((void*)0); | |||
4866 | clnt_local_t *local = NULL((void*)0); | |||
4867 | gfs3_fxattrop_req req = {{0,},}; | |||
4868 | int op_errno = ESTALE116; | |||
4869 | int ret = 0; | |||
4870 | int count = 0; | |||
4871 | struct iobref *rsp_iobref = NULL((void*)0); | |||
4872 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
4873 | struct iovec *rsphdr = NULL((void*)0); | |||
4874 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
4875 | ||||
4876 | if (!frame || !this || !data) | |||
4877 | goto unwind; | |||
4878 | ||||
4879 | args = data; | |||
4880 | conf = this->private; | |||
4881 | ||||
4882 | CLIENT_GET_REMOTE_FD (this, args->fd, FALLBACK_TO_ANON_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4883, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
4883 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 4883, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
4884 | ret = client_fd_fop_prepare_local (frame, args->fd, remote_fd); | |||
4885 | if (ret) { | |||
4886 | op_errno = -ret; | |||
4887 | goto unwind; | |||
4888 | } | |||
4889 | ||||
4890 | local = frame->local; | |||
4891 | ||||
4892 | req.fd = remote_fd; | |||
4893 | req.flags = args->flags; | |||
4894 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
4895 | ||||
4896 | rsp_iobref = iobref_new (); | |||
4897 | if (rsp_iobref == NULL((void*)0)) { | |||
4898 | op_errno = ENOMEM12; | |||
4899 | goto unwind; | |||
4900 | } | |||
4901 | ||||
4902 | /* TODO: what is the size we should send ? */ | |||
4903 | rsp_iobuf = iobuf_get2 (this->ctx->iobuf_pool, 8 * GF_UNIT_KB1024ULL); | |||
4904 | if (rsp_iobuf == NULL((void*)0)) { | |||
4905 | op_errno = ENOMEM12; | |||
4906 | goto unwind; | |||
4907 | } | |||
4908 | ||||
4909 | iobref_add (rsp_iobref, rsp_iobuf); | |||
4910 | iobuf_unref (rsp_iobuf); | |||
4911 | rsphdr = &vector[0]; | |||
4912 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
4913 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
4914 | count = 1; | |||
4915 | local->iobref = rsp_iobref; | |||
4916 | rsp_iobuf = NULL((void*)0); | |||
4917 | rsp_iobref = NULL((void*)0); | |||
4918 | ||||
4919 | if (args->xattr) { | |||
4920 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xattr,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4923, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4921 | (&req.dict.dict_val),do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4923, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4922 | req.dict.dict_len,do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4923, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4923 | op_errno, unwind)do { int ret = 0; if (!args->xattr) break; ret = dict_allocate_and_serialize (args->xattr, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xattr")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4923, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xattr")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4924 | } | |||
4925 | ||||
4926 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4927, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4927 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4927, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4928 | ||||
4929 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4930 | GFS3_OP_FXATTROP, | |||
4931 | client3_3_fxattrop_cbk, NULL((void*)0), | |||
4932 | rsphdr, count, | |||
4933 | NULL((void*)0), 0, local->iobref, | |||
4934 | (xdrproc_t)xdr_gfs3_fxattrop_req); | |||
4935 | if (ret) { | |||
4936 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 4936, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
4937 | } | |||
4938 | ||||
4939 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4940 | ||||
4941 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4942 | ||||
4943 | return 0; | |||
4944 | unwind: | |||
4945 | CLIENT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fxattrop_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 4945, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fxattrop_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
4946 | ||||
4947 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
4948 | ||||
4949 | if (rsp_iobref) | |||
4950 | iobref_unref (rsp_iobref); | |||
4951 | ||||
4952 | if (rsp_iobuf) | |||
4953 | iobuf_unref (rsp_iobuf); | |||
4954 | ||||
4955 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
4956 | ||||
4957 | return 0; | |||
4958 | } | |||
4959 | ||||
4960 | ||||
4961 | int32_t | |||
4962 | client3_3_removexattr (call_frame_t *frame, xlator_t *this, | |||
4963 | void *data) | |||
4964 | { | |||
4965 | clnt_conf_t *conf = NULL((void*)0); | |||
4966 | clnt_args_t *args = NULL((void*)0); | |||
4967 | gfs3_removexattr_req req = {{0,},}; | |||
4968 | int ret = 0; | |||
4969 | int op_errno = ESTALE116; | |||
4970 | ||||
4971 | if (!frame || !this || !data) | |||
4972 | goto unwind; | |||
4973 | ||||
4974 | args = data; | |||
4975 | ||||
4976 | if (!(args->loc && args->loc->inode)) | |||
4977 | goto unwind; | |||
4978 | ||||
4979 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
4980 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
4981 | else | |||
4982 | memcpy (req.gfid, args->loc->gfid, 16); | |||
4983 | ||||
4984 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4986, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4985 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4986, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
4986 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 4986, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
4987 | req.name = (char *)args->name; | |||
4988 | ||||
4989 | conf = this->private; | |||
4990 | ||||
4991 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4992, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
4992 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 4992, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
4993 | ||||
4994 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
4995 | GFS3_OP_REMOVEXATTR, | |||
4996 | client3_3_removexattr_cbk, NULL((void*)0), | |||
4997 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
4998 | (xdrproc_t)xdr_gfs3_removexattr_req); | |||
4999 | if (ret) { | |||
5000 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5000, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5001 | } | |||
5002 | ||||
5003 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5004 | ||||
5005 | return 0; | |||
5006 | unwind: | |||
5007 | CLIENT_STACK_UNWIND (removexattr, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5007, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_removexattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root->stack_lock); { _parent->ref_count --; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5008 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5009 | ||||
5010 | return 0; | |||
5011 | } | |||
5012 | ||||
5013 | int32_t | |||
5014 | client3_3_fremovexattr (call_frame_t *frame, xlator_t *this, | |||
5015 | void *data) | |||
5016 | { | |||
5017 | clnt_conf_t *conf = NULL((void*)0); | |||
5018 | clnt_args_t *args = NULL((void*)0); | |||
5019 | gfs3_fremovexattr_req req = {{0,},}; | |||
5020 | int ret = 0; | |||
5021 | int64_t remote_fd = -1; | |||
5022 | int op_errno = ESTALE116; | |||
5023 | ||||
5024 | if (!frame || !this || !data) | |||
5025 | goto unwind; | |||
5026 | ||||
5027 | args = data; | |||
5028 | ||||
5029 | if (!(args->fd && args->fd->inode)) | |||
5030 | goto unwind; | |||
5031 | ||||
5032 | conf = this->private; | |||
5033 | ||||
5034 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5035, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5035 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5035, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5036 | ||||
5037 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
5038 | req.name = (char *)args->name; | |||
5039 | req.fd = remote_fd; | |||
5040 | ||||
5041 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5042, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5042 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5042, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5043 | ||||
5044 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5045 | GFS3_OP_FREMOVEXATTR, | |||
5046 | client3_3_fremovexattr_cbk, NULL((void*)0), | |||
5047 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
5048 | (xdrproc_t)xdr_gfs3_fremovexattr_req); | |||
5049 | if (ret) { | |||
5050 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5050, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5051 | } | |||
5052 | ||||
5053 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5054 | ||||
5055 | return 0; | |||
5056 | unwind: | |||
5057 | CLIENT_STACK_UNWIND (fremovexattr, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fremovexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5057, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fremovexattr_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock (&frame->root->stack_lock); { _parent->ref_count --; } pthread_spin_unlock (&frame->root->stack_lock ); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5058 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5059 | ||||
5060 | return 0; | |||
5061 | } | |||
5062 | ||||
5063 | int32_t | |||
5064 | client3_3_lk (call_frame_t *frame, xlator_t *this, | |||
5065 | void *data) | |||
5066 | { | |||
5067 | clnt_args_t *args = NULL((void*)0); | |||
5068 | gfs3_lk_req req = {{0,},}; | |||
5069 | int32_t gf_cmd = 0; | |||
5070 | int32_t gf_type = 0; | |||
5071 | int64_t remote_fd = -1; | |||
5072 | clnt_local_t *local = NULL((void*)0); | |||
5073 | clnt_conf_t *conf = NULL((void*)0); | |||
5074 | int op_errno = ESTALE116; | |||
5075 | int ret = 0; | |||
5076 | ||||
5077 | if (!frame || !this || !data) | |||
5078 | goto unwind; | |||
5079 | ||||
5080 | args = data; | |||
5081 | conf = this->private; | |||
5082 | local = mem_get0 (this->local_pool); | |||
5083 | if (!local) { | |||
5084 | op_errno = ENOMEM12; | |||
5085 | goto unwind; | |||
5086 | } | |||
5087 | ||||
5088 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5089, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5089 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5089, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5090 | ||||
5091 | ret = client_cmd_to_gf_cmd (args->cmd, &gf_cmd); | |||
5092 | if (ret) { | |||
5093 | op_errno = EINVAL22; | |||
5094 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Unknown cmd (%d)!", gf_cmd); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5095, GF_LOG_WARNING, "Unknown cmd (%d)!", gf_cmd); } while (0) | |||
5095 | "Unknown cmd (%d)!", gf_cmd)do { do { if (0) printf ("Unknown cmd (%d)!", gf_cmd); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5095, GF_LOG_WARNING, "Unknown cmd (%d)!", gf_cmd); } while (0); | |||
5096 | goto unwind; | |||
5097 | } | |||
5098 | ||||
5099 | switch (args->flock->l_type) { | |||
5100 | case F_RDLCK0: | |||
5101 | gf_type = GF_LK_F_RDLCK; | |||
5102 | break; | |||
5103 | case F_WRLCK1: | |||
5104 | gf_type = GF_LK_F_WRLCK; | |||
5105 | break; | |||
5106 | case F_UNLCK2: | |||
5107 | gf_type = GF_LK_F_UNLCK; | |||
5108 | break; | |||
5109 | } | |||
5110 | ||||
5111 | local->owner = frame->root->lk_owner; | |||
5112 | local->cmd = args->cmd; | |||
5113 | local->fd = fd_ref (args->fd); | |||
5114 | frame->local = local; | |||
5115 | ||||
5116 | req.fd = remote_fd; | |||
5117 | req.cmd = gf_cmd; | |||
5118 | req.type = gf_type; | |||
5119 | gf_proto_flock_from_flock (&req.flock, args->flock); | |||
5120 | ||||
5121 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
5122 | ||||
5123 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5124, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5124 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5124, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5125 | ||||
5126 | ret = client_submit_request (this, &req, frame, conf->fops, GFS3_OP_LK, | |||
5127 | client3_3_lk_cbk, NULL((void*)0), | |||
5128 | NULL((void*)0), 0, NULL((void*)0), 0, NULL((void*)0), | |||
5129 | (xdrproc_t)xdr_gfs3_lk_req); | |||
5130 | if (ret) { | |||
5131 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5131, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5132 | } | |||
5133 | ||||
5134 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5135 | ||||
5136 | return 0; | |||
5137 | unwind: | |||
5138 | CLIENT_STACK_UNWIND (lk, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_lk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5138, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_lk_cbk_t )frame-> ret; _parent = frame->parent; pthread_spin_lock (&frame ->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5139 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5140 | ||||
5141 | return 0; | |||
5142 | } | |||
5143 | ||||
5144 | ||||
5145 | int32_t | |||
5146 | client3_3_inodelk (call_frame_t *frame, xlator_t *this, | |||
5147 | void *data) | |||
5148 | { | |||
5149 | clnt_conf_t *conf = NULL((void*)0); | |||
5150 | clnt_args_t *args = NULL((void*)0); | |||
5151 | gfs3_inodelk_req req = {{0,},}; | |||
5152 | int ret = 0; | |||
5153 | int32_t gf_cmd = 0; | |||
5154 | int32_t gf_type = 0; | |||
5155 | int op_errno = ESTALE116; | |||
5156 | ||||
5157 | if (!frame || !this || !data) | |||
5158 | goto unwind; | |||
5159 | ||||
5160 | args = data; | |||
5161 | if (!(args->loc && args->loc->inode)) | |||
5162 | goto unwind; | |||
5163 | ||||
5164 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
5165 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
5166 | else | |||
5167 | memcpy (req.gfid, args->loc->gfid, 16); | |||
5168 | ||||
5169 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5171, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
5170 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5171, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
5171 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5171, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
5172 | if (args->cmd == F_GETLK12 || args->cmd == F_GETLK6412) | |||
5173 | gf_cmd = GF_LK_GETLK; | |||
5174 | else if (args->cmd == F_SETLK13 || args->cmd == F_SETLK6413) | |||
5175 | gf_cmd = GF_LK_SETLK; | |||
5176 | else if (args->cmd == F_SETLKW14 || args->cmd == F_SETLKW6414) | |||
5177 | gf_cmd = GF_LK_SETLKW; | |||
5178 | else { | |||
5179 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Unknown cmd (%d)!", gf_cmd); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5180, GF_LOG_WARNING, "Unknown cmd (%d)!", gf_cmd); } while (0) | |||
5180 | "Unknown cmd (%d)!", gf_cmd)do { do { if (0) printf ("Unknown cmd (%d)!", gf_cmd); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5180, GF_LOG_WARNING, "Unknown cmd (%d)!", gf_cmd); } while (0); | |||
5181 | op_errno = EINVAL22; | |||
5182 | goto unwind; | |||
5183 | } | |||
5184 | ||||
5185 | switch (args->flock->l_type) { | |||
5186 | case F_RDLCK0: | |||
5187 | gf_type = GF_LK_F_RDLCK; | |||
5188 | break; | |||
5189 | case F_WRLCK1: | |||
5190 | gf_type = GF_LK_F_WRLCK; | |||
5191 | break; | |||
5192 | case F_UNLCK2: | |||
5193 | gf_type = GF_LK_F_UNLCK; | |||
5194 | break; | |||
5195 | } | |||
5196 | ||||
5197 | req.volume = (char *)args->volume; | |||
5198 | req.cmd = gf_cmd; | |||
5199 | req.type = gf_type; | |||
5200 | gf_proto_flock_from_flock (&req.flock, args->flock); | |||
5201 | ||||
5202 | conf = this->private; | |||
5203 | ||||
5204 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5205, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5205 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5205, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5206 | ||||
5207 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5208 | GFS3_OP_INODELK, | |||
5209 | client3_3_inodelk_cbk, NULL((void*)0), | |||
5210 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
5211 | NULL((void*)0), (xdrproc_t)xdr_gfs3_inodelk_req); | |||
5212 | if (ret) { | |||
5213 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5213, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5214 | } | |||
5215 | ||||
5216 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5217 | ||||
5218 | return 0; | |||
5219 | unwind: | |||
5220 | CLIENT_STACK_UNWIND (inodelk, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_inodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5220, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_inodelk_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
5221 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5222 | ||||
5223 | return 0; | |||
5224 | } | |||
5225 | ||||
5226 | ||||
5227 | ||||
5228 | int32_t | |||
5229 | client3_3_finodelk (call_frame_t *frame, xlator_t *this, | |||
5230 | void *data) | |||
5231 | { | |||
5232 | clnt_args_t *args = NULL((void*)0); | |||
5233 | gfs3_finodelk_req req = {{0,},}; | |||
5234 | int32_t gf_cmd = 0; | |||
5235 | int32_t gf_type = 0; | |||
5236 | int64_t remote_fd = -1; | |||
5237 | clnt_conf_t *conf = NULL((void*)0); | |||
5238 | int op_errno = ESTALE116; | |||
5239 | int ret = 0; | |||
5240 | ||||
5241 | if (!frame || !this || !data) | |||
5242 | goto unwind; | |||
5243 | ||||
5244 | args = data; | |||
5245 | conf = this->private; | |||
5246 | CLIENT_GET_REMOTE_FD (this, args->fd, FALLBACK_TO_ANON_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5247, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5247 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, FALLBACK_TO_ANON_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5247, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5248 | ret = client_fd_fop_prepare_local (frame, args->fd, remote_fd); | |||
5249 | if (ret) { | |||
5250 | op_errno = -ret; | |||
5251 | goto unwind; | |||
5252 | } | |||
5253 | ||||
5254 | if (args->cmd == F_GETLK12 || args->cmd == F_GETLK6412) | |||
5255 | gf_cmd = GF_LK_GETLK; | |||
5256 | else if (args->cmd == F_SETLK13 || args->cmd == F_SETLK6413) | |||
5257 | gf_cmd = GF_LK_SETLK; | |||
5258 | else if (args->cmd == F_SETLKW14 || args->cmd == F_SETLKW6414) | |||
5259 | gf_cmd = GF_LK_SETLKW; | |||
5260 | else { | |||
5261 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Unknown cmd (%d)!", gf_cmd); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5262, GF_LOG_WARNING, "Unknown cmd (%d)!", gf_cmd); } while (0) | |||
5262 | "Unknown cmd (%d)!", gf_cmd)do { do { if (0) printf ("Unknown cmd (%d)!", gf_cmd); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5262, GF_LOG_WARNING, "Unknown cmd (%d)!", gf_cmd); } while (0); | |||
5263 | goto unwind; | |||
5264 | } | |||
5265 | ||||
5266 | switch (args->flock->l_type) { | |||
5267 | case F_RDLCK0: | |||
5268 | gf_type = GF_LK_F_RDLCK; | |||
5269 | break; | |||
5270 | case F_WRLCK1: | |||
5271 | gf_type = GF_LK_F_WRLCK; | |||
5272 | break; | |||
5273 | case F_UNLCK2: | |||
5274 | gf_type = GF_LK_F_UNLCK; | |||
5275 | break; | |||
5276 | } | |||
5277 | ||||
5278 | req.volume = (char *)args->volume; | |||
5279 | req.fd = remote_fd; | |||
5280 | req.cmd = gf_cmd; | |||
5281 | req.type = gf_type; | |||
5282 | gf_proto_flock_from_flock (&req.flock, args->flock); | |||
5283 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
5284 | ||||
5285 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5286, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5286 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5286, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5287 | ||||
5288 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5289 | GFS3_OP_FINODELK, | |||
5290 | client3_3_finodelk_cbk, NULL((void*)0), | |||
5291 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
5292 | NULL((void*)0), (xdrproc_t)xdr_gfs3_finodelk_req); | |||
5293 | if (ret) { | |||
5294 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5294, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5295 | } | |||
5296 | ||||
5297 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5298 | return 0; | |||
5299 | unwind: | |||
5300 | CLIENT_STACK_UNWIND (finodelk, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_finodelk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5300, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_finodelk_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5301 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5302 | ||||
5303 | return 0; | |||
5304 | } | |||
5305 | ||||
5306 | ||||
5307 | int32_t | |||
5308 | client3_3_entrylk (call_frame_t *frame, xlator_t *this, | |||
5309 | void *data) | |||
5310 | { | |||
5311 | clnt_conf_t *conf = NULL((void*)0); | |||
5312 | clnt_args_t *args = NULL((void*)0); | |||
5313 | gfs3_entrylk_req req = {{0,},}; | |||
5314 | int ret = 0; | |||
5315 | int op_errno = ESTALE116; | |||
5316 | ||||
5317 | if (!frame || !this || !data) | |||
5318 | goto unwind; | |||
5319 | ||||
5320 | args = data; | |||
5321 | ||||
5322 | if (!(args->loc && args->loc->inode)) | |||
5323 | goto unwind; | |||
5324 | ||||
5325 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
5326 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
5327 | else | |||
5328 | memcpy (req.gfid, args->loc->gfid, 16); | |||
5329 | ||||
5330 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5332, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
5331 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5332, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
5332 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5332, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
5333 | req.cmd = args->cmd_entrylk; | |||
5334 | req.type = args->type; | |||
5335 | req.volume = (char *)args->volume; | |||
5336 | req.name = ""; | |||
5337 | if (args->basename) { | |||
5338 | req.name = (char *)args->basename; | |||
5339 | req.namelen = 1; | |||
5340 | } | |||
5341 | ||||
5342 | conf = this->private; | |||
5343 | ||||
5344 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5345, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5345 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5345, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5346 | ||||
5347 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5348 | GFS3_OP_ENTRYLK, | |||
5349 | client3_3_entrylk_cbk, NULL((void*)0), | |||
5350 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
5351 | NULL((void*)0), (xdrproc_t)xdr_gfs3_entrylk_req); | |||
5352 | if (ret) { | |||
5353 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5353, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5354 | } | |||
5355 | ||||
5356 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5357 | ||||
5358 | return 0; | |||
5359 | unwind: | |||
5360 | CLIENT_STACK_UNWIND (entrylk, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_entrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5360, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_entrylk_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); client_local_wipe (__local); } while (0); | |||
5361 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5362 | ||||
5363 | return 0; | |||
5364 | } | |||
5365 | ||||
5366 | ||||
5367 | ||||
5368 | int32_t | |||
5369 | client3_3_fentrylk (call_frame_t *frame, xlator_t *this, | |||
5370 | void *data) | |||
5371 | { | |||
5372 | clnt_args_t *args = NULL((void*)0); | |||
5373 | gfs3_fentrylk_req req = {{0,},}; | |||
5374 | int64_t remote_fd = -1; | |||
5375 | clnt_conf_t *conf = NULL((void*)0); | |||
5376 | int op_errno = ESTALE116; | |||
5377 | int ret = 0; | |||
5378 | ||||
5379 | if (!frame || !this || !data) | |||
5380 | goto unwind; | |||
5381 | ||||
5382 | args = data; | |||
5383 | conf = this->private; | |||
5384 | ||||
5385 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5386, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5386 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5386, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5387 | ||||
5388 | req.fd = remote_fd; | |||
5389 | req.cmd = args->cmd_entrylk; | |||
5390 | req.type = args->type; | |||
5391 | req.volume = (char *)args->volume; | |||
5392 | req.name = ""; | |||
5393 | if (args->basename) { | |||
5394 | req.name = (char *)args->basename; | |||
5395 | req.namelen = 1; | |||
5396 | } | |||
5397 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
5398 | ||||
5399 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5400, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5400 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5400, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5401 | ||||
5402 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5403 | GFS3_OP_FENTRYLK, | |||
5404 | client3_3_fentrylk_cbk, NULL((void*)0), | |||
5405 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
5406 | NULL((void*)0), (xdrproc_t)xdr_gfs3_fentrylk_req); | |||
5407 | if (ret) { | |||
5408 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5408, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5409 | } | |||
5410 | ||||
5411 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5412 | ||||
5413 | return 0; | |||
5414 | unwind: | |||
5415 | CLIENT_STACK_UNWIND (fentrylk, frame, -1, op_errno, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fentrylk_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5415, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fentrylk_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5416 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5417 | ||||
5418 | return 0; | |||
5419 | } | |||
5420 | ||||
5421 | ||||
5422 | int32_t | |||
5423 | client3_3_rchecksum (call_frame_t *frame, xlator_t *this, | |||
5424 | void *data) | |||
5425 | { | |||
5426 | clnt_args_t *args = NULL((void*)0); | |||
5427 | int64_t remote_fd = -1; | |||
5428 | clnt_conf_t *conf = NULL((void*)0); | |||
5429 | gfs3_rchecksum_req req = {0,}; | |||
5430 | int op_errno = ESTALE116; | |||
5431 | int ret = 0; | |||
5432 | ||||
5433 | if (!frame || !this || !data) | |||
5434 | goto unwind; | |||
5435 | ||||
5436 | args = data; | |||
5437 | conf = this->private; | |||
5438 | ||||
5439 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5440, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5440 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5440, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5441 | ||||
5442 | req.len = args->len; | |||
5443 | req.offset = args->offset; | |||
5444 | req.fd = remote_fd; | |||
5445 | ||||
5446 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5447, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5447 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5447, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5448 | ||||
5449 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5450 | GFS3_OP_RCHECKSUM, | |||
5451 | client3_3_rchecksum_cbk, NULL((void*)0), | |||
5452 | NULL((void*)0), 0, NULL((void*)0), | |||
5453 | 0, NULL((void*)0), | |||
5454 | (xdrproc_t)xdr_gfs3_rchecksum_req); | |||
5455 | if (ret) { | |||
5456 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5456, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5457 | } | |||
5458 | ||||
5459 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5460 | ||||
5461 | return 0; | |||
5462 | unwind: | |||
5463 | CLIENT_STACK_UNWIND (rchecksum, frame, -1, op_errno, 0, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_rchecksum_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5463, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_rchecksum_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, 0, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5464 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5465 | ||||
5466 | return 0; | |||
5467 | } | |||
5468 | ||||
5469 | ||||
5470 | ||||
5471 | int32_t | |||
5472 | client3_3_readdir (call_frame_t *frame, xlator_t *this, | |||
5473 | void *data) | |||
5474 | { | |||
5475 | clnt_args_t *args = NULL((void*)0); | |||
5476 | int64_t remote_fd = -1; | |||
5477 | clnt_conf_t *conf = NULL((void*)0); | |||
5478 | gfs3_readdir_req req = {{0,},}; | |||
5479 | gfs3_readdir_rsp rsp = {0, }; | |||
5480 | clnt_local_t *local = NULL((void*)0); | |||
| ||||
5481 | int op_errno = ESTALE116; | |||
5482 | int ret = 0; | |||
5483 | int count = 0; | |||
5484 | struct iobref *rsp_iobref = NULL((void*)0); | |||
5485 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
5486 | struct iovec *rsphdr = NULL((void*)0); | |||
5487 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
5488 | int readdir_rsp_size = 0; | |||
5489 | ||||
5490 | if (!frame || !this || !data) | |||
5491 | goto unwind; | |||
5492 | ||||
5493 | args = data; | |||
5494 | conf = this->private; | |||
5495 | ||||
5496 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5497, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5497 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5497, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5498 | ||||
5499 | readdir_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfs3_readdir_rsp, &rsp) | |||
5500 | + args->size; | |||
5501 | ||||
5502 | if ((readdir_rsp_size + GLUSTERFS_RPC_REPLY_SIZE24 + GLUSTERFS_RDMA_MAX_HEADER_SIZE(228)) | |||
5503 | > (GLUSTERFS_RDMA_INLINE_THRESHOLD(2048))) { | |||
5504 | local = mem_get0 (this->local_pool); | |||
5505 | if (!local) { | |||
5506 | op_errno = ENOMEM12; | |||
5507 | goto unwind; | |||
5508 | } | |||
5509 | frame->local = local; | |||
5510 | ||||
5511 | rsp_iobref = iobref_new (); | |||
5512 | if (rsp_iobref == NULL((void*)0)) { | |||
5513 | goto unwind; | |||
5514 | } | |||
5515 | ||||
5516 | /* TODO: what is the size we should send ? */ | |||
5517 | /* This iobuf will live for only receiving the response, | |||
5518 | so not harmful */ | |||
5519 | rsp_iobuf = iobuf_get (this->ctx->iobuf_pool); | |||
5520 | if (rsp_iobuf == NULL((void*)0)) { | |||
5521 | goto unwind; | |||
5522 | } | |||
5523 | ||||
5524 | iobref_add (rsp_iobref, rsp_iobuf); | |||
5525 | iobuf_unref (rsp_iobuf); | |||
5526 | ||||
5527 | rsphdr = &vector[0]; | |||
5528 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
5529 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
5530 | count = 1; | |||
5531 | local->iobref = rsp_iobref; | |||
5532 | rsp_iobuf = NULL((void*)0); | |||
5533 | rsp_iobref = NULL((void*)0); | |||
5534 | } | |||
5535 | ||||
5536 | req.size = args->size; | |||
5537 | req.offset = args->offset; | |||
5538 | req.fd = remote_fd; | |||
5539 | ||||
5540 | local->cmd = remote_fd; | |||
| ||||
5541 | ||||
5542 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
5543 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5544, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5544 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5544, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5545 | ||||
5546 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5547 | GFS3_OP_READDIR, | |||
5548 | client3_3_readdir_cbk, NULL((void*)0), | |||
5549 | rsphdr, count, | |||
5550 | NULL((void*)0), 0, rsp_iobref, | |||
5551 | (xdrproc_t)xdr_gfs3_readdir_req); | |||
5552 | ||||
5553 | if (ret) { | |||
5554 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5554, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5555 | } | |||
5556 | ||||
5557 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5558 | ||||
5559 | if (rsp_iobuf) | |||
5560 | iobuf_unref (rsp_iobuf); | |||
5561 | ||||
5562 | if (rsp_iobref) | |||
5563 | iobref_unref (rsp_iobref); | |||
5564 | ||||
5565 | return 0; | |||
5566 | ||||
5567 | unwind: | |||
5568 | if (rsp_iobref) | |||
5569 | iobref_unref (rsp_iobref); | |||
5570 | ||||
5571 | if (rsp_iobuf) | |||
5572 | iobuf_unref (rsp_iobuf); | |||
5573 | ||||
5574 | CLIENT_STACK_UNWIND (readdir, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5574, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readdir_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5575 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5576 | ||||
5577 | return 0; | |||
5578 | } | |||
5579 | ||||
5580 | ||||
5581 | int32_t | |||
5582 | client3_3_readdirp (call_frame_t *frame, xlator_t *this, | |||
5583 | void *data) | |||
5584 | { | |||
5585 | clnt_args_t *args = NULL((void*)0); | |||
5586 | gfs3_readdirp_req req = {{0,},}; | |||
5587 | gfs3_readdirp_rsp rsp = {0,}; | |||
5588 | int64_t remote_fd = -1; | |||
5589 | clnt_conf_t *conf = NULL((void*)0); | |||
5590 | int op_errno = ESTALE116; | |||
5591 | int ret = 0; | |||
5592 | int count = 0; | |||
5593 | int readdirp_rsp_size = 0; | |||
5594 | struct iobref *rsp_iobref = NULL((void*)0); | |||
5595 | struct iobuf *rsp_iobuf = NULL((void*)0); | |||
5596 | struct iovec *rsphdr = NULL((void*)0); | |||
5597 | struct iovec vector[MAX_IOVEC16] = {{0}, }; | |||
5598 | clnt_local_t *local = NULL((void*)0); | |||
5599 | ||||
5600 | if (!frame || !this || !data) | |||
5601 | goto unwind; | |||
5602 | ||||
5603 | args = data; | |||
5604 | conf = this->private; | |||
5605 | ||||
5606 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5607, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5607 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5607, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5608 | ||||
5609 | readdirp_rsp_size = xdr_sizeof ((xdrproc_t) xdr_gfs3_readdirp_rsp, &rsp) | |||
5610 | + args->size; | |||
5611 | ||||
5612 | local = mem_get0 (this->local_pool); | |||
5613 | if (!local) { | |||
5614 | op_errno = ENOMEM12; | |||
5615 | goto unwind; | |||
5616 | } | |||
5617 | frame->local = local; | |||
5618 | ||||
5619 | if ((readdirp_rsp_size + GLUSTERFS_RPC_REPLY_SIZE24 | |||
5620 | + GLUSTERFS_RDMA_MAX_HEADER_SIZE(228)) | |||
5621 | > (GLUSTERFS_RDMA_INLINE_THRESHOLD(2048))) { | |||
5622 | rsp_iobref = iobref_new (); | |||
5623 | if (rsp_iobref == NULL((void*)0)) { | |||
5624 | goto unwind; | |||
5625 | } | |||
5626 | ||||
5627 | /* TODO: what is the size we should send ? */ | |||
5628 | /* This iobuf will live for only receiving the response, | |||
5629 | so not harmful */ | |||
5630 | rsp_iobuf = iobuf_get (this->ctx->iobuf_pool); | |||
5631 | if (rsp_iobuf == NULL((void*)0)) { | |||
5632 | goto unwind; | |||
5633 | } | |||
5634 | ||||
5635 | iobref_add (rsp_iobref, rsp_iobuf); | |||
5636 | iobuf_unref (rsp_iobuf); | |||
5637 | ||||
5638 | rsphdr = &vector[0]; | |||
5639 | rsphdr->iov_base = iobuf_ptr (rsp_iobuf)((rsp_iobuf)->ptr); | |||
5640 | rsphdr->iov_len = iobuf_pagesize (rsp_iobuf)(rsp_iobuf->iobuf_arena->page_size); | |||
5641 | count = 1; | |||
5642 | local->iobref = rsp_iobref; | |||
5643 | rsp_iobuf = NULL((void*)0); | |||
5644 | rsp_iobref = NULL((void*)0); | |||
5645 | } | |||
5646 | ||||
5647 | local->fd = fd_ref (args->fd); | |||
5648 | ||||
5649 | req.size = args->size; | |||
5650 | req.offset = args->offset; | |||
5651 | req.fd = remote_fd; | |||
5652 | memcpy (req.gfid, args->fd->inode->gfid, 16); | |||
5653 | ||||
5654 | /* dict itself is 'xdata' here */ | |||
5655 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.dict.dict_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5656, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5656 | req.dict.dict_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.dict.dict_val), &req.dict.dict_len ); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5656, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5657 | ||||
5658 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5659 | GFS3_OP_READDIRP, | |||
5660 | client3_3_readdirp_cbk, NULL((void*)0), | |||
5661 | rsphdr, count, NULL((void*)0), | |||
5662 | 0, rsp_iobref, | |||
5663 | (xdrproc_t)xdr_gfs3_readdirp_req); | |||
5664 | if (ret) { | |||
5665 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5665, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5666 | } | |||
5667 | ||||
5668 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
5669 | ||||
5670 | if (rsp_iobuf) | |||
5671 | iobuf_unref (rsp_iobuf); | |||
5672 | ||||
5673 | if (rsp_iobref) | |||
5674 | iobref_unref (rsp_iobref); | |||
5675 | ||||
5676 | return 0; | |||
5677 | unwind: | |||
5678 | if (rsp_iobref) | |||
5679 | iobref_unref (rsp_iobref); | |||
5680 | ||||
5681 | if (rsp_iobuf) | |||
5682 | iobuf_unref (rsp_iobuf); | |||
5683 | ||||
5684 | GF_FREE (req.dict.dict_val)__gf_free (req.dict.dict_val); | |||
5685 | ||||
5686 | CLIENT_STACK_UNWIND (readdirp, frame, -1, op_errno, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_readdirp_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5686, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_readdirp_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5687 | return 0; | |||
5688 | } | |||
5689 | ||||
5690 | ||||
5691 | int32_t | |||
5692 | client3_3_setattr (call_frame_t *frame, xlator_t *this, | |||
5693 | void *data) | |||
5694 | { | |||
5695 | clnt_conf_t *conf = NULL((void*)0); | |||
5696 | clnt_args_t *args = NULL((void*)0); | |||
5697 | gfs3_setattr_req req = {{0,},}; | |||
5698 | int ret = 0; | |||
5699 | int op_errno = ESTALE116; | |||
5700 | ||||
5701 | if (!frame || !this || !data) | |||
5702 | goto unwind; | |||
5703 | ||||
5704 | args = data; | |||
5705 | ||||
5706 | if (!(args->loc && args->loc->inode)) | |||
5707 | goto unwind; | |||
5708 | ||||
5709 | if (!uuid_is_null (args->loc->inode->gfid)) | |||
5710 | memcpy (req.gfid, args->loc->inode->gfid, 16); | |||
5711 | else | |||
5712 | memcpy (req.gfid, args->loc->gfid, 16); | |||
5713 | ||||
5714 | GF_ASSERT_AND_GOTO_WITH_ERROR (this->name,do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5716, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
5715 | !uuid_is_null (*((uuid_t*)req.gfid)),do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5716, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0) | |||
5716 | unwind, op_errno, EINVAL)do { if (!!uuid_is_null (*((uuid_t*)req.gfid))) { do { if (!( 0)) { do { do { if (0) printf ("Assertion failed: " "0"); } while (0); _gf_log_callingfn ("", "client-rpc-fops.c", __FUNCTION__ , 5716, GF_LOG_ERROR, "Assertion failed: " "0"); } while (0); } } while (0); op_errno = 22; goto unwind; } }while (0); | |||
5717 | req.valid = args->valid; | |||
5718 | gf_stat_from_iatt (&req.stbuf, args->stbuf); | |||
5719 | ||||
5720 | conf = this->private; | |||
5721 | ||||
5722 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5723, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5723 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5723, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5724 | ||||
5725 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5726 | GFS3_OP_SETATTR, | |||
5727 | client3_3_setattr_cbk, NULL((void*)0), | |||
5728 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
5729 | NULL((void*)0), (xdrproc_t)xdr_gfs3_setattr_req); | |||
5730 | if (ret) { | |||
5731 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5731, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5732 | } | |||
5733 | ||||
5734 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5735 | ||||
5736 | return 0; | |||
5737 | unwind: | |||
5738 | CLIENT_STACK_UNWIND (setattr, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5738, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_setattr_cbk_t )frame ->ret; _parent = frame->parent; pthread_spin_lock (& frame->root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5739 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5740 | ||||
5741 | return 0; | |||
5742 | } | |||
5743 | ||||
5744 | int32_t | |||
5745 | client3_3_fsetattr (call_frame_t *frame, xlator_t *this, void *data) | |||
5746 | { | |||
5747 | clnt_args_t *args = NULL((void*)0); | |||
5748 | int64_t remote_fd = -1; | |||
5749 | clnt_conf_t *conf = NULL((void*)0); | |||
5750 | gfs3_fsetattr_req req = {0,}; | |||
5751 | int op_errno = ESTALE116; | |||
5752 | int ret = 0; | |||
5753 | ||||
5754 | if (!frame || !this || !data) | |||
5755 | goto unwind; | |||
5756 | ||||
5757 | args = data; | |||
5758 | conf = this->private; | |||
5759 | ||||
5760 | CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD,do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5761, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0) | |||
5761 | remote_fd, op_errno, unwind)do { int _ret = 0; _ret = client_get_remote_fd (this, args-> fd, DEFAULT_REMOTE_FD, &remote_fd); if (_ret < 0) { op_errno = (*__errno_location ()); goto unwind; } if (remote_fd == -1 ) { do { do { if (0) printf (" (%s) " "remote_fd is -1. EBADFD" , uuid_utoa (args->fd->inode->gfid)); } while (0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__, 5761, GF_LOG_WARNING , " (%s) " "remote_fd is -1. EBADFD", uuid_utoa (args->fd-> inode->gfid)); } while (0); op_errno = 77; goto unwind; } } while (0); | |||
5762 | ||||
5763 | req.fd = remote_fd; | |||
5764 | req.valid = args->valid; | |||
5765 | gf_stat_from_iatt (&req.stbuf, args->stbuf); | |||
5766 | ||||
5767 | GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5768, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0) | |||
5768 | req.xdata.xdata_len, op_errno, unwind)do { int ret = 0; if (!args->xdata) break; ret = dict_allocate_and_serialize (args->xdata, (&req.xdata.xdata_val), &req.xdata. xdata_len); if (ret < 0) { do { do { if (0) printf ("failed to get serialized dict (%s)" , ("args->xdata")); } while (0); _gf_log (this->name, "client-rpc-fops.c" , __FUNCTION__, 5768, GF_LOG_WARNING, "failed to get serialized dict (%s)" , ("args->xdata")); } while (0); op_errno = 22; goto unwind ; } } while (0); | |||
5769 | ||||
5770 | ret = client_submit_request (this, &req, frame, conf->fops, | |||
5771 | GFS3_OP_FSETATTR, | |||
5772 | client3_3_fsetattr_cbk, NULL((void*)0), | |||
5773 | NULL((void*)0), 0, NULL((void*)0), 0, | |||
5774 | NULL((void*)0), (xdrproc_t)xdr_gfs3_fsetattr_req); | |||
5775 | if (ret) { | |||
5776 | gf_log (this->name, GF_LOG_WARNING, "failed to send the fop")do { do { if (0) printf ("failed to send the fop"); } while ( 0); _gf_log (this->name, "client-rpc-fops.c", __FUNCTION__ , 5776, GF_LOG_WARNING, "failed to send the fop"); } while (0 ); | |||
5777 | } | |||
5778 | ||||
5779 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5780 | ||||
5781 | return 0; | |||
5782 | unwind: | |||
5783 | CLIENT_STACK_UNWIND (fsetattr, frame, -1, op_errno, NULL, NULL, NULL)do { clnt_local_t *__local = frame->local; frame->local = ((void*)0); do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if ( !frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack", "client-rpc-fops.c", __FUNCTION__, 5783, GF_LOG_CRITICAL , "!frame"); } while (0); break; } fn = (fop_fsetattr_cbk_t ) frame->ret; _parent = frame->parent; pthread_spin_lock ( &frame->root->stack_lock); { _parent->ref_count-- ; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location ()) = _parent->this; frame->complete = _gf_true; frame-> unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency ) gf_latency_end (frame); fn (_parent, frame->cookie, _parent ->this, -1, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); client_local_wipe (__local); } while (0); | |||
5784 | GF_FREE (req.xdata.xdata_val)__gf_free (req.xdata.xdata_val); | |||
5785 | ||||
5786 | return 0; | |||
5787 | } | |||
5788 | ||||
5789 | ||||
5790 | ||||
5791 | /* Table Specific to FOPS */ | |||
5792 | ||||
5793 | ||||
5794 | rpc_clnt_procedure_t clnt3_3_fop_actors[GF_FOP_MAXVALUE] = { | |||
5795 | [GF_FOP_NULL] = { "NULL", NULL((void*)0)}, | |||
5796 | [GF_FOP_STAT] = { "STAT", client3_3_stat }, | |||
5797 | [GF_FOP_READLINK] = { "READLINK", client3_3_readlink }, | |||
5798 | [GF_FOP_MKNOD] = { "MKNOD", client3_3_mknod }, | |||
5799 | [GF_FOP_MKDIR] = { "MKDIR", client3_3_mkdir }, | |||
5800 | [GF_FOP_UNLINK] = { "UNLINK", client3_3_unlink }, | |||
5801 | [GF_FOP_RMDIR] = { "RMDIR", client3_3_rmdir }, | |||
5802 | [GF_FOP_SYMLINK] = { "SYMLINK", client3_3_symlink }, | |||
5803 | [GF_FOP_RENAME] = { "RENAME", client3_3_rename }, | |||
5804 | [GF_FOP_LINK] = { "LINK", client3_3_link }, | |||
5805 | [GF_FOP_TRUNCATE] = { "TRUNCATE", client3_3_truncate }, | |||
5806 | [GF_FOP_OPEN] = { "OPEN", client3_3_open }, | |||
5807 | [GF_FOP_READ] = { "READ", client3_3_readv }, | |||
5808 | [GF_FOP_WRITE] = { "WRITE", client3_3_writev }, | |||
5809 | [GF_FOP_STATFS] = { "STATFS", client3_3_statfs }, | |||
5810 | [GF_FOP_FLUSH] = { "FLUSH", client3_3_flush }, | |||
5811 | [GF_FOP_FSYNC] = { "FSYNC", client3_3_fsync }, | |||
5812 | [GF_FOP_SETXATTR] = { "SETXATTR", client3_3_setxattr }, | |||
5813 | [GF_FOP_GETXATTR] = { "GETXATTR", client3_3_getxattr }, | |||
5814 | [GF_FOP_REMOVEXATTR] = { "REMOVEXATTR", client3_3_removexattr }, | |||
5815 | [GF_FOP_OPENDIR] = { "OPENDIR", client3_3_opendir }, | |||
5816 | [GF_FOP_FSYNCDIR] = { "FSYNCDIR", client3_3_fsyncdir }, | |||
5817 | [GF_FOP_ACCESS] = { "ACCESS", client3_3_access }, | |||
5818 | [GF_FOP_CREATE] = { "CREATE", client3_3_create }, | |||
5819 | [GF_FOP_FTRUNCATE] = { "FTRUNCATE", client3_3_ftruncate }, | |||
5820 | [GF_FOP_FSTAT] = { "FSTAT", client3_3_fstat }, | |||
5821 | [GF_FOP_LK] = { "LK", client3_3_lk }, | |||
5822 | [GF_FOP_LOOKUP] = { "LOOKUP", client3_3_lookup }, | |||
5823 | [GF_FOP_READDIR] = { "READDIR", client3_3_readdir }, | |||
5824 | [GF_FOP_INODELK] = { "INODELK", client3_3_inodelk }, | |||
5825 | [GF_FOP_FINODELK] = { "FINODELK", client3_3_finodelk }, | |||
5826 | [GF_FOP_ENTRYLK] = { "ENTRYLK", client3_3_entrylk }, | |||
5827 | [GF_FOP_FENTRYLK] = { "FENTRYLK", client3_3_fentrylk }, | |||
5828 | [GF_FOP_XATTROP] = { "XATTROP", client3_3_xattrop }, | |||
5829 | [GF_FOP_FXATTROP] = { "FXATTROP", client3_3_fxattrop }, | |||
5830 | [GF_FOP_FGETXATTR] = { "FGETXATTR", client3_3_fgetxattr }, | |||
5831 | [GF_FOP_FSETXATTR] = { "FSETXATTR", client3_3_fsetxattr }, | |||
5832 | [GF_FOP_RCHECKSUM] = { "RCHECKSUM", client3_3_rchecksum }, | |||
5833 | [GF_FOP_SETATTR] = { "SETATTR", client3_3_setattr }, | |||
5834 | [GF_FOP_FSETATTR] = { "FSETATTR", client3_3_fsetattr }, | |||
5835 | [GF_FOP_READDIRP] = { "READDIRP", client3_3_readdirp }, | |||
5836 | [GF_FOP_RELEASE] = { "RELEASE", client3_3_release }, | |||
5837 | [GF_FOP_RELEASEDIR] = { "RELEASEDIR", client3_3_releasedir }, | |||
5838 | [GF_FOP_GETSPEC] = { "GETSPEC", client3_getspec }, | |||
5839 | [GF_FOP_FREMOVEXATTR] = { "FREMOVEXATTR", client3_3_fremovexattr }, | |||
5840 | }; | |||
5841 | ||||
5842 | /* Used From RPC-CLNT library to log proper name of procedure based on number */ | |||
5843 | char *clnt3_3_fop_names[GFS3_OP_MAXVALUE] = { | |||
5844 | [GFS3_OP_NULL] = "NULL", | |||
5845 | [GFS3_OP_STAT] = "STAT", | |||
5846 | [GFS3_OP_READLINK] = "READLINK", | |||
5847 | [GFS3_OP_MKNOD] = "MKNOD", | |||
5848 | [GFS3_OP_MKDIR] = "MKDIR", | |||
5849 | [GFS3_OP_UNLINK] = "UNLINK", | |||
5850 | [GFS3_OP_RMDIR] = "RMDIR", | |||
5851 | [GFS3_OP_SYMLINK] = "SYMLINK", | |||
5852 | [GFS3_OP_RENAME] = "RENAME", | |||
5853 | [GFS3_OP_LINK] = "LINK", | |||
5854 | [GFS3_OP_TRUNCATE] = "TRUNCATE", | |||
5855 | [GFS3_OP_OPEN] = "OPEN", | |||
5856 | [GFS3_OP_READ] = "READ", | |||
5857 | [GFS3_OP_WRITE] = "WRITE", | |||
5858 | [GFS3_OP_STATFS] = "STATFS", | |||
5859 | [GFS3_OP_FLUSH] = "FLUSH", | |||
5860 | [GFS3_OP_FSYNC] = "FSYNC", | |||
5861 | [GFS3_OP_SETXATTR] = "SETXATTR", | |||
5862 | [GFS3_OP_GETXATTR] = "GETXATTR", | |||
5863 | [GFS3_OP_REMOVEXATTR] = "REMOVEXATTR", | |||
5864 | [GFS3_OP_OPENDIR] = "OPENDIR", | |||
5865 | [GFS3_OP_FSYNCDIR] = "FSYNCDIR", | |||
5866 | [GFS3_OP_ACCESS] = "ACCESS", | |||
5867 | [GFS3_OP_CREATE] = "CREATE", | |||
5868 | [GFS3_OP_FTRUNCATE] = "FTRUNCATE", | |||
5869 | [GFS3_OP_FSTAT] = "FSTAT", | |||
5870 | [GFS3_OP_LK] = "LK", | |||
5871 | [GFS3_OP_LOOKUP] = "LOOKUP", | |||
5872 | [GFS3_OP_READDIR] = "READDIR", | |||
5873 | [GFS3_OP_INODELK] = "INODELK", | |||
5874 | [GFS3_OP_FINODELK] = "FINODELK", | |||
5875 | [GFS3_OP_ENTRYLK] = "ENTRYLK", | |||
5876 | [GFS3_OP_FENTRYLK] = "FENTRYLK", | |||
5877 | [GFS3_OP_XATTROP] = "XATTROP", | |||
5878 | [GFS3_OP_FXATTROP] = "FXATTROP", | |||
5879 | [GFS3_OP_FGETXATTR] = "FGETXATTR", | |||
5880 | [GFS3_OP_FSETXATTR] = "FSETXATTR", | |||
5881 | [GFS3_OP_RCHECKSUM] = "RCHECKSUM", | |||
5882 | [GFS3_OP_SETATTR] = "SETATTR", | |||
5883 | [GFS3_OP_FSETATTR] = "FSETATTR", | |||
5884 | [GFS3_OP_READDIRP] = "READDIRP", | |||
5885 | [GFS3_OP_RELEASE] = "RELEASE", | |||
5886 | [GFS3_OP_RELEASEDIR] = "RELEASEDIR", | |||
5887 | [GFS3_OP_FREMOVEXATTR] = "FREMOVEXATTR", | |||
5888 | }; | |||
5889 | ||||
5890 | rpc_clnt_prog_t clnt3_3_fop_prog = { | |||
5891 | .progname = "GlusterFS 3.3", | |||
5892 | .prognum = GLUSTER_FOP_PROGRAM1298437, | |||
5893 | .progver = GLUSTER_FOP_VERSION330, | |||
5894 | .numproc = GLUSTER_FOP_PROCCNTGFS3_OP_MAXVALUE, | |||
5895 | .proctable = clnt3_3_fop_actors, | |||
5896 | .procnames = clnt3_3_fop_names, | |||
5897 | }; |