File: | xlators/protocol/client/src/client.c |
Location: | line 84, column 9 |
Description: | Value stored to 'rpc' is never read |
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 | |
12 | #ifndef _CONFIG_H |
13 | #define _CONFIG_H |
14 | #include "config.h" |
15 | #endif |
16 | |
17 | #include "client.h" |
18 | #include "xlator.h" |
19 | #include "defaults.h" |
20 | #include "glusterfs.h" |
21 | #include "statedump.h" |
22 | #include "compat-errno.h" |
23 | |
24 | #include "glusterfs3.h" |
25 | |
26 | extern rpc_clnt_prog_t clnt_handshake_prog; |
27 | extern rpc_clnt_prog_t clnt_dump_prog; |
28 | extern struct rpcclnt_cb_program gluster_cbk_prog; |
29 | |
30 | int client_handshake (xlator_t *this, struct rpc_clnt *rpc); |
31 | void client_start_ping (void *data); |
32 | int client_init_rpc (xlator_t *this); |
33 | int client_destroy_rpc (xlator_t *this); |
34 | int client_mark_fd_bad (xlator_t *this); |
35 | |
36 | int32_t |
37 | client_type_to_gf_type (short l_type) |
38 | { |
39 | int32_t gf_type = GF_LK_EOL; |
40 | |
41 | switch (l_type) { |
42 | case F_RDLCK0: |
43 | gf_type = GF_LK_F_RDLCK; |
44 | break; |
45 | case F_WRLCK1: |
46 | gf_type = GF_LK_F_WRLCK; |
47 | break; |
48 | case F_UNLCK2: |
49 | gf_type = GF_LK_F_UNLCK; |
50 | break; |
51 | } |
52 | |
53 | return gf_type; |
54 | } |
55 | |
56 | uint32_t |
57 | client_get_lk_ver (clnt_conf_t *conf) |
58 | { |
59 | uint32_t lk_ver = 0; |
60 | |
61 | GF_VALIDATE_OR_GOTO ("client", conf, out)do { if (!conf) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "conf"); } while (0); _gf_log_callingfn ("client", "client.c", __FUNCTION__, 61, GF_LOG_ERROR, "invalid argument: " "conf"); } while (0); goto out; } } while (0); |
62 | |
63 | pthread_mutex_lock (&conf->lock); |
64 | { |
65 | lk_ver = conf->lk_version; |
66 | } |
67 | pthread_mutex_unlock (&conf->lock); |
68 | out: |
69 | return lk_ver; |
70 | } |
71 | |
72 | void |
73 | client_grace_timeout (void *data) |
74 | { |
75 | int ver = 0; |
76 | xlator_t *this = NULL((void*)0); |
77 | struct clnt_conf *conf = NULL((void*)0); |
78 | struct rpc_clnt *rpc = NULL((void*)0); |
79 | |
80 | GF_VALIDATE_OR_GOTO ("client", data, out)do { if (!data) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "data"); } while (0); _gf_log_callingfn ("client", "client.c", __FUNCTION__, 80, GF_LOG_ERROR, "invalid argument: " "data"); } while (0); goto out; } } while (0); |
81 | |
82 | this = THIS(*__glusterfs_this_location()); |
83 | |
84 | rpc = (struct rpc_clnt *) data; |
Value stored to 'rpc' is never read | |
85 | |
86 | conf = (struct clnt_conf *) this->private; |
87 | |
88 | pthread_mutex_lock (&conf->lock); |
89 | { |
90 | ver = ++conf->lk_version; |
91 | /* ver == 0 is a special value used by server |
92 | to notify client that this is a fresh connect.*/ |
93 | if (ver == 0) |
94 | ver = ++conf->lk_version; |
95 | |
96 | gf_timer_call_cancel (this->ctx, conf->grace_timer); |
97 | conf->grace_timer = NULL((void*)0); |
98 | } |
99 | pthread_mutex_unlock (&conf->lock); |
100 | |
101 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("client grace timer expired, updating " "the lk-version to %d", ver); } while (0); _gf_log (this-> name, "client.c", __FUNCTION__, 103, GF_LOG_WARNING, "client grace timer expired, updating " "the lk-version to %d", ver); } while (0) |
102 | "client grace timer expired, updating "do { do { if (0) printf ("client grace timer expired, updating " "the lk-version to %d", ver); } while (0); _gf_log (this-> name, "client.c", __FUNCTION__, 103, GF_LOG_WARNING, "client grace timer expired, updating " "the lk-version to %d", ver); } while (0) |
103 | "the lk-version to %d", ver)do { do { if (0) printf ("client grace timer expired, updating " "the lk-version to %d", ver); } while (0); _gf_log (this-> name, "client.c", __FUNCTION__, 103, GF_LOG_WARNING, "client grace timer expired, updating " "the lk-version to %d", ver); } while (0); |
104 | |
105 | client_mark_fd_bad (this); |
106 | out: |
107 | return; |
108 | } |
109 | |
110 | int32_t |
111 | client_register_grace_timer (xlator_t *this, clnt_conf_t *conf) |
112 | { |
113 | int32_t ret = -1; |
114 | |
115 | 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.c", __FUNCTION__, 115, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); |
116 | GF_VALIDATE_OR_GOTO (this->name, conf, out)do { if (!conf) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "conf"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__, 116, GF_LOG_ERROR, "invalid argument: " "conf"); } while (0); goto out; } } while (0); |
117 | |
118 | pthread_mutex_lock (&conf->lock); |
119 | { |
120 | if (conf->grace_timer || !conf->grace_timer_needed) { |
121 | gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 124, GF_LOG_TRACE, "Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer"); } while (0) |
122 | "Client grace timer is already set "do { do { if (0) printf ("Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 124, GF_LOG_TRACE, "Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer"); } while (0) |
123 | "or a grace-timer has already time out, "do { do { if (0) printf ("Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 124, GF_LOG_TRACE, "Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer"); } while (0) |
124 | "not registering a new timer")do { do { if (0) printf ("Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 124, GF_LOG_TRACE, "Client grace timer is already set " "or a grace-timer has already time out, " "not registering a new timer"); } while (0); |
125 | } else { |
126 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("Registering a grace timer"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 127, GF_LOG_INFO , "Registering a grace timer"); } while (0) |
127 | "Registering a grace timer")do { do { if (0) printf ("Registering a grace timer"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 127, GF_LOG_INFO , "Registering a grace timer"); } while (0); |
128 | |
129 | conf->grace_timer_needed = _gf_false; |
130 | |
131 | conf->grace_timer = |
132 | gf_timer_call_after (this->ctx, |
133 | conf->grace_tv, |
134 | client_grace_timeout, |
135 | conf->rpc); |
136 | } |
137 | } |
138 | pthread_mutex_unlock (&conf->lock); |
139 | |
140 | ret = 0; |
141 | out: |
142 | return ret; |
143 | } |
144 | |
145 | int |
146 | client_submit_request (xlator_t *this, void *req, call_frame_t *frame, |
147 | rpc_clnt_prog_t *prog, int procnum, fop_cbk_fn_t cbkfn, |
148 | struct iobref *iobref, struct iovec *rsphdr, |
149 | int rsphdr_count, struct iovec *rsp_payload, |
150 | int rsp_payload_count, struct iobref *rsp_iobref, |
151 | xdrproc_t xdrproc) |
152 | { |
153 | int ret = -1; |
154 | clnt_conf_t *conf = NULL((void*)0); |
155 | struct iovec iov = {0, }; |
156 | struct iobuf *iobuf = NULL((void*)0); |
157 | int count = 0; |
158 | char start_ping = 0; |
159 | struct iobref *new_iobref = NULL((void*)0); |
160 | ssize_t xdr_size = 0; |
161 | struct rpc_req rpcreq = {0, }; |
162 | |
163 | 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.c", __FUNCTION__, 163, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); |
164 | GF_VALIDATE_OR_GOTO (this->name, prog, out)do { if (!prog) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "prog"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__, 164, GF_LOG_ERROR, "invalid argument: " "prog"); } while (0); goto out; } } while (0); |
165 | GF_VALIDATE_OR_GOTO (this->name, frame, out)do { if (!frame) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__, 165, GF_LOG_ERROR, "invalid argument: " "frame"); } while (0); goto out; } } while (0); |
166 | |
167 | conf = this->private; |
168 | |
169 | /* If 'setvolume' is not successful, we should not send frames to |
170 | server, mean time we should be able to send 'DUMP' and 'SETVOLUME' |
171 | call itself even if its not connected */ |
172 | if (!(conf->connected || |
173 | ((prog->prognum == GLUSTER_DUMP_PROGRAM123451501) || |
174 | (prog->prognum == GLUSTER_PMAP_PROGRAM34123456) || |
175 | ((prog->prognum == GLUSTER_HNDSK_PROGRAM14398633) && |
176 | (procnum == GF_HNDSK_SETVOLUME))))) { |
177 | /* This particular error captured/logged in |
178 | functions calling this */ |
179 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("connection in disconnected state"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 180, GF_LOG_DEBUG, "connection in disconnected state"); } while (0) |
180 | "connection in disconnected state")do { do { if (0) printf ("connection in disconnected state"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 180, GF_LOG_DEBUG, "connection in disconnected state"); } while (0); |
181 | goto out; |
182 | } |
183 | |
184 | if (req && xdrproc) { |
185 | xdr_size = xdr_sizeof (xdrproc, req); |
186 | iobuf = iobuf_get2 (this->ctx->iobuf_pool, xdr_size); |
187 | if (!iobuf) { |
188 | goto out; |
189 | }; |
190 | |
191 | new_iobref = iobref_new (); |
192 | if (!new_iobref) { |
193 | goto out; |
194 | } |
195 | |
196 | if (iobref != NULL((void*)0)) { |
197 | ret = iobref_merge (new_iobref, iobref); |
198 | if (ret != 0) { |
199 | 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.c" , __FUNCTION__, 201, GF_LOG_WARNING, "cannot merge iobref passed from caller " "into new_iobref"); } while (0) |
200 | "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.c" , __FUNCTION__, 201, GF_LOG_WARNING, "cannot merge iobref passed from caller " "into new_iobref"); } while (0) |
201 | "into new_iobref")do { do { if (0) printf ("cannot merge iobref passed from caller " "into new_iobref"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 201, GF_LOG_WARNING, "cannot merge iobref passed from caller " "into new_iobref"); } while (0); |
202 | } |
203 | } |
204 | |
205 | ret = iobref_add (new_iobref, iobuf); |
206 | if (ret != 0) { |
207 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("cannot add iobuf into iobref"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 208, GF_LOG_WARNING , "cannot add iobuf into iobref"); } while (0) |
208 | "cannot add iobuf into iobref")do { do { if (0) printf ("cannot add iobuf into iobref"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 208, GF_LOG_WARNING , "cannot add iobuf into iobref"); } while (0); |
209 | goto out; |
210 | } |
211 | |
212 | iov.iov_base = iobuf->ptr; |
213 | iov.iov_len = iobuf_size (iobuf); |
214 | |
215 | /* Create the xdr payload */ |
216 | ret = xdr_serialize_generic (iov, req, xdrproc); |
217 | if (ret == -1) { |
218 | /* callingfn so that, we can get to know which xdr |
219 | function was called */ |
220 | gf_log_callingfn (this->name, GF_LOG_WARNING,do { do { if (0) printf ("XDR payload creation failed"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__ , 221, GF_LOG_WARNING, "XDR payload creation failed"); } while (0) |
221 | "XDR payload creation failed")do { do { if (0) printf ("XDR payload creation failed"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__ , 221, GF_LOG_WARNING, "XDR payload creation failed"); } while (0); |
222 | goto out; |
223 | } |
224 | iov.iov_len = ret; |
225 | count = 1; |
226 | } |
227 | |
228 | /* Send the msg */ |
229 | ret = rpc_clnt_submit (conf->rpc, prog, procnum, cbkfn, &iov, count, |
230 | NULL((void*)0), 0, new_iobref, frame, rsphdr, rsphdr_count, |
231 | rsp_payload, rsp_payload_count, rsp_iobref); |
232 | |
233 | if (ret < 0) { |
234 | 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.c", __FUNCTION__, 234, GF_LOG_DEBUG , "rpc_clnt_submit failed"); } while (0); |
235 | } |
236 | |
237 | if (ret == 0) { |
238 | pthread_mutex_lock (&conf->rpc->conn.lock); |
239 | { |
240 | if (!conf->rpc->conn.ping_started) { |
241 | start_ping = 1; |
242 | } |
243 | } |
244 | pthread_mutex_unlock (&conf->rpc->conn.lock); |
245 | } |
246 | |
247 | if (start_ping) |
248 | client_start_ping ((void *) this); |
249 | |
250 | ret = 0; |
251 | |
252 | if (new_iobref) |
253 | iobref_unref (new_iobref); |
254 | |
255 | if (iobuf) |
256 | iobuf_unref (iobuf); |
257 | |
258 | return ret; |
259 | |
260 | out: |
261 | rpcreq.rpc_status = -1; |
262 | |
263 | cbkfn (&rpcreq, NULL((void*)0), 0, frame); |
264 | |
265 | if (new_iobref) |
266 | iobref_unref (new_iobref); |
267 | |
268 | if (iobuf) |
269 | iobuf_unref (iobuf); |
270 | |
271 | return 0; |
272 | } |
273 | |
274 | |
275 | int32_t |
276 | client_forget (xlator_t *this, inode_t *inode) |
277 | { |
278 | /* Nothing here */ |
279 | return 0; |
280 | } |
281 | |
282 | int32_t |
283 | client_releasedir (xlator_t *this, fd_t *fd) |
284 | { |
285 | int ret = -1; |
286 | clnt_conf_t *conf = NULL((void*)0); |
287 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
288 | clnt_args_t args = {0,}; |
289 | |
290 | conf = this->private; |
291 | if (!conf || !conf->fops) |
292 | goto out; |
293 | |
294 | args.fd = fd; |
295 | |
296 | proc = &conf->fops->proctable[GF_FOP_RELEASEDIR]; |
297 | if (!proc) { |
298 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RELEASEDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 300, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RELEASEDIR]); } while (0) |
299 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RELEASEDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 300, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RELEASEDIR]); } while (0) |
300 | gf_fop_list[GF_FOP_RELEASEDIR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RELEASEDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 300, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RELEASEDIR]); } while (0); |
301 | goto out; |
302 | } |
303 | if (proc->fn) { |
304 | ret = proc->fn (NULL((void*)0), this, &args); |
305 | } |
306 | out: |
307 | if (ret) |
308 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("releasedir fop failed"); } while (0 ); _gf_log (this->name, "client.c", __FUNCTION__, 309, GF_LOG_WARNING , "releasedir fop failed"); } while (0) |
309 | "releasedir fop failed")do { do { if (0) printf ("releasedir fop failed"); } while (0 ); _gf_log (this->name, "client.c", __FUNCTION__, 309, GF_LOG_WARNING , "releasedir fop failed"); } while (0); |
310 | return 0; |
311 | } |
312 | |
313 | int32_t |
314 | client_release (xlator_t *this, fd_t *fd) |
315 | { |
316 | int ret = -1; |
317 | clnt_conf_t *conf = NULL((void*)0); |
318 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
319 | clnt_args_t args = {0,}; |
320 | |
321 | conf = this->private; |
322 | if (!conf || !conf->fops) |
323 | goto out; |
324 | |
325 | args.fd = fd; |
326 | proc = &conf->fops->proctable[GF_FOP_RELEASE]; |
327 | if (!proc) { |
328 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RELEASE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 330, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RELEASE]); } while (0) |
329 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RELEASE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 330, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RELEASE]); } while (0) |
330 | gf_fop_list[GF_FOP_RELEASE])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RELEASE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 330, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RELEASE]); } while (0); |
331 | goto out; |
332 | } |
333 | if (proc->fn) { |
334 | ret = proc->fn (NULL((void*)0), this, &args); |
335 | } |
336 | out: |
337 | if (ret) |
338 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("release fop failed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 339, GF_LOG_WARNING , "release fop failed"); } while (0) |
339 | "release fop failed")do { do { if (0) printf ("release fop failed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 339, GF_LOG_WARNING , "release fop failed"); } while (0); |
340 | return 0; |
341 | } |
342 | |
343 | |
344 | int32_t |
345 | client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, |
346 | dict_t *xdata) |
347 | { |
348 | int ret = -1; |
349 | clnt_conf_t *conf = NULL((void*)0); |
350 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
351 | clnt_args_t args = {0,}; |
352 | |
353 | conf = this->private; |
354 | if (!conf || !conf->fops) |
355 | goto out; |
356 | |
357 | args.loc = loc; |
358 | args.xdata = xdata; |
359 | |
360 | proc = &conf->fops->proctable[GF_FOP_LOOKUP]; |
361 | if (!proc) { |
362 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LOOKUP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 364, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LOOKUP]); } while (0) |
363 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LOOKUP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 364, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LOOKUP]); } while (0) |
364 | gf_fop_list[GF_FOP_LOOKUP])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LOOKUP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 364, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LOOKUP]); } while (0); |
365 | goto out; |
366 | } |
367 | if (proc->fn) |
368 | ret = proc->fn (frame, this, &args); |
369 | out: |
370 | /* think of avoiding a missing frame */ |
371 | if (ret) |
372 | STACK_UNWIND_STRICT (lookup, frame, -1, ENOTCONN,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.c", __FUNCTION__, 373, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
373 | NULL, NULL, NULL, NULL)do { fop_lookup_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 373, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
374 | |
375 | return 0; |
376 | } |
377 | |
378 | |
379 | int32_t |
380 | client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) |
381 | { |
382 | int ret = -1; |
383 | clnt_conf_t *conf = NULL((void*)0); |
384 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
385 | clnt_args_t args = {0,}; |
386 | |
387 | conf = this->private; |
388 | if (!conf || !conf->fops) |
389 | goto out; |
390 | |
391 | args.loc = loc; |
392 | args.xdata = xdata; |
393 | |
394 | proc = &conf->fops->proctable[GF_FOP_STAT]; |
395 | if (!proc) { |
396 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_STAT]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 398, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_STAT]); } while (0) |
397 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_STAT]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 398, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_STAT]); } while (0) |
398 | gf_fop_list[GF_FOP_STAT])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_STAT]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 398, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_STAT]); } while (0); |
399 | goto out; |
400 | } |
401 | if (proc->fn) |
402 | ret = proc->fn (frame, this, &args); |
403 | out: |
404 | if (ret) |
405 | STACK_UNWIND_STRICT (stat, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 405, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
406 | |
407 | return 0; |
408 | } |
409 | |
410 | |
411 | int32_t |
412 | client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, |
413 | off_t offset, dict_t *xdata) |
414 | { |
415 | int ret = -1; |
416 | clnt_conf_t *conf = NULL((void*)0); |
417 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
418 | clnt_args_t args = {0,}; |
419 | |
420 | conf = this->private; |
421 | if (!conf || !conf->fops) |
422 | goto out; |
423 | |
424 | args.loc = loc; |
425 | args.offset = offset; |
426 | args.xdata = xdata; |
427 | |
428 | proc = &conf->fops->proctable[GF_FOP_TRUNCATE]; |
429 | if (!proc) { |
430 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_TRUNCATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 432, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_TRUNCATE]); } while (0) |
431 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_TRUNCATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 432, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_TRUNCATE]); } while (0) |
432 | gf_fop_list[GF_FOP_TRUNCATE])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_TRUNCATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 432, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_TRUNCATE]); } while (0); |
433 | goto out; |
434 | } |
435 | if (proc->fn) |
436 | ret = proc->fn (frame, this, &args); |
437 | out: |
438 | if (ret) |
439 | STACK_UNWIND_STRICT (truncate, frame, -1, ENOTCONN, NULL, NULL, NULL)do { fop_truncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 439, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
440 | |
441 | |
442 | return 0; |
443 | } |
444 | |
445 | |
446 | int32_t |
447 | client_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, |
448 | off_t offset, dict_t *xdata) |
449 | { |
450 | int ret = -1; |
451 | clnt_conf_t *conf = NULL((void*)0); |
452 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
453 | clnt_args_t args = {0,}; |
454 | |
455 | conf = this->private; |
456 | if (!conf || !conf->fops) |
457 | goto out; |
458 | |
459 | args.fd = fd; |
460 | args.offset = offset; |
461 | args.xdata = xdata; |
462 | |
463 | proc = &conf->fops->proctable[GF_FOP_FTRUNCATE]; |
464 | if (!proc) { |
465 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FTRUNCATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 467, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FTRUNCATE]); } while (0) |
466 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FTRUNCATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 467, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FTRUNCATE]); } while (0) |
467 | gf_fop_list[GF_FOP_FTRUNCATE])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FTRUNCATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 467, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FTRUNCATE]); } while (0); |
468 | goto out; |
469 | } |
470 | if (proc->fn) |
471 | ret = proc->fn (frame, this, &args); |
472 | out: |
473 | if (ret) |
474 | STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOTCONN, NULL, NULL, NULL)do { fop_ftruncate_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 474, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
475 | |
476 | return 0; |
477 | } |
478 | |
479 | |
480 | |
481 | int32_t |
482 | client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, |
483 | int32_t mask, dict_t *xdata) |
484 | { |
485 | int ret = -1; |
486 | clnt_conf_t *conf = NULL((void*)0); |
487 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
488 | clnt_args_t args = {0,}; |
489 | |
490 | conf = this->private; |
491 | if (!conf || !conf->fops) |
492 | goto out; |
493 | |
494 | args.loc = loc; |
495 | args.mask = mask; |
496 | args.xdata = xdata; |
497 | |
498 | proc = &conf->fops->proctable[GF_FOP_ACCESS]; |
499 | if (!proc) { |
500 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_ACCESS]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 502, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_ACCESS]); } while (0) |
501 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_ACCESS]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 502, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_ACCESS]); } while (0) |
502 | gf_fop_list[GF_FOP_ACCESS])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_ACCESS]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 502, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_ACCESS]); } while (0); |
503 | goto out; |
504 | } |
505 | if (proc->fn) |
506 | ret = proc->fn (frame, this, &args); |
507 | out: |
508 | if (ret) |
509 | STACK_UNWIND_STRICT (access, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 509, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
510 | |
511 | return 0; |
512 | } |
513 | |
514 | |
515 | |
516 | |
517 | int32_t |
518 | client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, |
519 | size_t size, dict_t *xdata) |
520 | { |
521 | int ret = -1; |
522 | clnt_conf_t *conf = NULL((void*)0); |
523 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
524 | clnt_args_t args = {0,}; |
525 | |
526 | conf = this->private; |
527 | if (!conf || !conf->fops) |
528 | goto out; |
529 | |
530 | args.loc = loc; |
531 | args.size = size; |
532 | args.xdata = xdata; |
533 | |
534 | proc = &conf->fops->proctable[GF_FOP_READLINK]; |
535 | if (!proc) { |
536 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 538, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READLINK]); } while (0) |
537 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 538, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READLINK]); } while (0) |
538 | gf_fop_list[GF_FOP_READLINK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 538, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READLINK]); } while (0); |
539 | goto out; |
540 | } |
541 | if (proc->fn) |
542 | ret = proc->fn (frame, this, &args); |
543 | out: |
544 | if (ret) |
545 | STACK_UNWIND_STRICT (readlink, frame, -1, ENOTCONN, NULL, NULL, NULL)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.c", __FUNCTION__, 545, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
546 | |
547 | return 0; |
548 | } |
549 | |
550 | |
551 | int |
552 | client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, |
553 | dev_t rdev, mode_t umask, dict_t *xdata) |
554 | { |
555 | int ret = -1; |
556 | clnt_conf_t *conf = NULL((void*)0); |
557 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
558 | clnt_args_t args = {0,}; |
559 | |
560 | conf = this->private; |
561 | if (!conf || !conf->fops) |
562 | goto out; |
563 | |
564 | args.loc = loc; |
565 | args.mode = mode; |
566 | args.rdev = rdev; |
567 | args.umask = umask; |
568 | args.xdata = xdata; |
569 | |
570 | proc = &conf->fops->proctable[GF_FOP_MKNOD]; |
571 | if (!proc) { |
572 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_MKNOD]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 574, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_MKNOD]); } while (0) |
573 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_MKNOD]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 574, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_MKNOD]); } while (0) |
574 | gf_fop_list[GF_FOP_MKNOD])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_MKNOD]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 574, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_MKNOD]); } while (0); |
575 | goto out; |
576 | } |
577 | if (proc->fn) |
578 | ret = proc->fn (frame, this, &args); |
579 | out: |
580 | if (ret) |
581 | STACK_UNWIND_STRICT (mknod, frame, -1, ENOTCONN,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.c", __FUNCTION__, 582, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
582 | NULL, NULL, NULL, NULL, NULL)do { fop_mknod_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 582, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
583 | |
584 | return 0; |
585 | } |
586 | |
587 | |
588 | int |
589 | client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, |
590 | mode_t mode, mode_t umask, dict_t *xdata) |
591 | { |
592 | int ret = -1; |
593 | clnt_conf_t *conf = NULL((void*)0); |
594 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
595 | clnt_args_t args = {0,}; |
596 | |
597 | conf = this->private; |
598 | if (!conf || !conf->fops) |
599 | goto out; |
600 | |
601 | args.loc = loc; |
602 | args.mode = mode; |
603 | args.umask = umask; |
604 | args.xdata = xdata; |
605 | |
606 | proc = &conf->fops->proctable[GF_FOP_MKDIR]; |
607 | if (!proc) { |
608 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_MKDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 610, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_MKDIR]); } while (0) |
609 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_MKDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 610, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_MKDIR]); } while (0) |
610 | gf_fop_list[GF_FOP_MKDIR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_MKDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 610, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_MKDIR]); } while (0); |
611 | goto out; |
612 | } |
613 | if (proc->fn) |
614 | ret = proc->fn (frame, this, &args); |
615 | out: |
616 | if (ret) |
617 | STACK_UNWIND_STRICT (mkdir, frame, -1, ENOTCONN,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.c", __FUNCTION__, 618, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
618 | NULL, NULL, NULL, NULL, NULL)do { fop_mkdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 618, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
619 | |
620 | return 0; |
621 | } |
622 | |
623 | |
624 | |
625 | int32_t |
626 | client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, |
627 | int xflag, dict_t *xdata) |
628 | { |
629 | int ret = -1; |
630 | clnt_conf_t *conf = NULL((void*)0); |
631 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
632 | clnt_args_t args = {0,}; |
633 | |
634 | conf = this->private; |
635 | if (!conf || !conf->fops) |
636 | goto out; |
637 | |
638 | args.loc = loc; |
639 | args.xdata = xdata; |
640 | args.flags = xflag; |
641 | |
642 | proc = &conf->fops->proctable[GF_FOP_UNLINK]; |
643 | if (!proc) { |
644 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_UNLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 646, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_UNLINK]); } while (0) |
645 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_UNLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 646, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_UNLINK]); } while (0) |
646 | gf_fop_list[GF_FOP_UNLINK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_UNLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 646, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_UNLINK]); } while (0); |
647 | goto out; |
648 | } |
649 | if (proc->fn) |
650 | ret = proc->fn (frame, this, &args); |
651 | out: |
652 | if (ret) |
653 | STACK_UNWIND_STRICT (unlink, frame, -1, ENOTCONN,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.c", __FUNCTION__, 654, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
654 | NULL, NULL, NULL)do { fop_unlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 654, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
655 | |
656 | return 0; |
657 | } |
658 | |
659 | int32_t |
660 | client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, |
661 | dict_t *xdata) |
662 | { |
663 | int ret = -1; |
664 | clnt_conf_t *conf = NULL((void*)0); |
665 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
666 | clnt_args_t args = {0,}; |
667 | |
668 | conf = this->private; |
669 | if (!conf || !conf->fops) |
670 | goto out; |
671 | |
672 | args.loc = loc; |
673 | args.flags = flags; |
674 | args.xdata = xdata; |
675 | |
676 | proc = &conf->fops->proctable[GF_FOP_RMDIR]; |
677 | if (!proc) { |
678 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RMDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 680, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RMDIR]); } while (0) |
679 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RMDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 680, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RMDIR]); } while (0) |
680 | gf_fop_list[GF_FOP_RMDIR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RMDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 680, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RMDIR]); } while (0); |
681 | goto out; |
682 | } |
683 | if (proc->fn) |
684 | ret = proc->fn (frame, this, &args); |
685 | out: |
686 | /* think of avoiding a missing frame */ |
687 | if (ret) |
688 | STACK_UNWIND_STRICT (rmdir, frame, -1, ENOTCONN,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.c", __FUNCTION__, 689, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0) |
689 | NULL, NULL, NULL)do { fop_rmdir_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 689, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
690 | |
691 | return 0; |
692 | } |
693 | |
694 | |
695 | int |
696 | client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, |
697 | loc_t *loc, mode_t umask, dict_t *xdata) |
698 | { |
699 | int ret = -1; |
700 | clnt_conf_t *conf = NULL((void*)0); |
701 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
702 | clnt_args_t args = {0,}; |
703 | |
704 | conf = this->private; |
705 | if (!conf || !conf->fops) |
706 | goto out; |
707 | |
708 | args.linkname = linkpath; |
709 | args.loc = loc; |
710 | args.umask = umask; |
711 | args.xdata = xdata; |
712 | |
713 | proc = &conf->fops->proctable[GF_FOP_SYMLINK]; |
714 | if (!proc) { |
715 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SYMLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 717, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SYMLINK]); } while (0) |
716 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SYMLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 717, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SYMLINK]); } while (0) |
717 | gf_fop_list[GF_FOP_SYMLINK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SYMLINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 717, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SYMLINK]); } while (0); |
718 | goto out; |
719 | } |
720 | if (proc->fn) |
721 | ret = proc->fn (frame, this, &args); |
722 | out: |
723 | if (ret) |
724 | STACK_UNWIND_STRICT (symlink, frame, -1, ENOTCONN,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.c", __FUNCTION__, 725, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
725 | NULL, NULL, NULL, NULL, NULL)do { fop_symlink_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 725, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
726 | |
727 | return 0; |
728 | } |
729 | |
730 | |
731 | |
732 | int32_t |
733 | client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, |
734 | loc_t *newloc, dict_t *xdata) |
735 | { |
736 | int ret = -1; |
737 | clnt_conf_t *conf = NULL((void*)0); |
738 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
739 | clnt_args_t args = {0,}; |
740 | |
741 | conf = this->private; |
742 | if (!conf || !conf->fops) |
743 | goto out; |
744 | |
745 | args.oldloc = oldloc; |
746 | args.newloc = newloc; |
747 | args.xdata = xdata; |
748 | |
749 | proc = &conf->fops->proctable[GF_FOP_RENAME]; |
750 | if (!proc) { |
751 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RENAME]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 753, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RENAME]); } while (0) |
752 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RENAME]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 753, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RENAME]); } while (0) |
753 | gf_fop_list[GF_FOP_RENAME])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RENAME]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 753, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RENAME]); } while (0); |
754 | goto out; |
755 | } |
756 | if (proc->fn) |
757 | ret = proc->fn (frame, this, &args); |
758 | out: |
759 | if (ret) |
760 | STACK_UNWIND_STRICT (rename, frame, -1, ENOTCONN,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.c", __FUNCTION__, 761, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
761 | NULL, NULL, NULL, NULL, NULL, NULL)do { fop_rename_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 761, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
762 | |
763 | return 0; |
764 | } |
765 | |
766 | |
767 | |
768 | int32_t |
769 | client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, |
770 | loc_t *newloc, dict_t *xdata) |
771 | { |
772 | int ret = -1; |
773 | clnt_conf_t *conf = NULL((void*)0); |
774 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
775 | clnt_args_t args = {0,}; |
776 | |
777 | conf = this->private; |
778 | if (!conf || !conf->fops) |
779 | goto out; |
780 | |
781 | args.oldloc = oldloc; |
782 | args.newloc = newloc; |
783 | args.xdata = xdata; |
784 | |
785 | proc = &conf->fops->proctable[GF_FOP_LINK]; |
786 | if (!proc) { |
787 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 789, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LINK]); } while (0) |
788 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 789, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LINK]); } while (0) |
789 | gf_fop_list[GF_FOP_LINK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LINK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 789, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LINK]); } while (0); |
790 | goto out; |
791 | } |
792 | if (proc->fn) |
793 | ret = proc->fn (frame, this, &args); |
794 | out: |
795 | if (ret) |
796 | STACK_UNWIND_STRICT (link, frame, -1, ENOTCONN,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.c", __FUNCTION__, 797, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
797 | NULL, NULL, NULL, NULL, NULL)do { fop_link_cbk_t fn = ((void*)0); call_frame_t *_parent = ( (void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 797, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
798 | |
799 | return 0; |
800 | } |
801 | |
802 | |
803 | |
804 | int32_t |
805 | client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, |
806 | mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) |
807 | { |
808 | int ret = -1; |
809 | clnt_conf_t *conf = NULL((void*)0); |
810 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
811 | clnt_args_t args = {0,}; |
812 | |
813 | conf = this->private; |
814 | if (!conf || !conf->fops) |
815 | goto out; |
816 | |
817 | args.loc = loc; |
818 | args.mode = mode; |
819 | args.fd = fd; |
820 | args.umask = umask; |
821 | args.xdata = xdata; |
822 | |
823 | if (!conf->filter_o_direct) |
824 | args.flags = flags; |
825 | else |
826 | args.flags = (flags & ~O_DIRECT040000); |
827 | |
828 | proc = &conf->fops->proctable[GF_FOP_CREATE]; |
829 | if (!proc) { |
830 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_CREATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 832, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_CREATE]); } while (0) |
831 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_CREATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 832, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_CREATE]); } while (0) |
832 | gf_fop_list[GF_FOP_CREATE])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_CREATE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 832, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_CREATE]); } while (0); |
833 | goto out; |
834 | } |
835 | if (proc->fn) |
836 | ret = proc->fn (frame, this, &args); |
837 | out: |
838 | if (ret) |
839 | STACK_UNWIND_STRICT (create, frame, -1, ENOTCONN,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.c", __FUNCTION__, 840, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0) |
840 | NULL, NULL, NULL, NULL, NULL, NULL)do { fop_create_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 840, 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 , 107, ((void*)0), ((void*)0), ((void*)0), ((void*)0), ((void *)0), ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
841 | |
842 | return 0; |
843 | } |
844 | |
845 | |
846 | |
847 | int32_t |
848 | client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, |
849 | int32_t flags, fd_t *fd, dict_t *xdata) |
850 | { |
851 | int ret = -1; |
852 | clnt_conf_t *conf = NULL((void*)0); |
853 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
854 | clnt_args_t args = {0,}; |
855 | |
856 | conf = this->private; |
857 | if (!conf || !conf->fops) |
858 | goto out; |
859 | |
860 | args.loc = loc; |
861 | args.fd = fd; |
862 | args.xdata = xdata; |
863 | |
864 | if (!conf->filter_o_direct) |
865 | args.flags = flags; |
866 | else |
867 | args.flags = (flags & ~O_DIRECT040000); |
868 | |
869 | proc = &conf->fops->proctable[GF_FOP_OPEN]; |
870 | if (!proc) { |
871 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_OPEN]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 873, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_OPEN]); } while (0) |
872 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_OPEN]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 873, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_OPEN]); } while (0) |
873 | gf_fop_list[GF_FOP_OPEN])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_OPEN]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 873, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_OPEN]); } while (0); |
874 | goto out; |
875 | } |
876 | if (proc->fn) |
877 | ret = proc->fn (frame, this, &args); |
878 | |
879 | out: |
880 | if (ret) |
881 | STACK_UNWIND_STRICT (open, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 881, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
882 | |
883 | return 0; |
884 | } |
885 | |
886 | |
887 | |
888 | int32_t |
889 | client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, |
890 | off_t offset, uint32_t flags, dict_t *xdata) |
891 | { |
892 | int ret = -1; |
893 | clnt_conf_t *conf = NULL((void*)0); |
894 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
895 | clnt_args_t args = {0,}; |
896 | |
897 | conf = this->private; |
898 | if (!conf || !conf->fops) |
899 | goto out; |
900 | |
901 | args.fd = fd; |
902 | args.size = size; |
903 | args.offset = offset; |
904 | args.flags = flags; |
905 | args.xdata = xdata; |
906 | |
907 | proc = &conf->fops->proctable[GF_FOP_READ]; |
908 | if (!proc) { |
909 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READ]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 911, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READ]); } while (0) |
910 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READ]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 911, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READ]); } while (0) |
911 | gf_fop_list[GF_FOP_READ])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READ]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 911, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READ]); } while (0); |
912 | goto out; |
913 | } |
914 | if (proc->fn) |
915 | ret = proc->fn (frame, this, &args); |
916 | |
917 | out: |
918 | if (ret) |
919 | STACK_UNWIND_STRICT (readv, frame, -1, ENOTCONN,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.c", __FUNCTION__, 920, 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 , 107, ((void*)0), 0, ((void*)0), ((void*)0), ((void*)0)); (* __glusterfs_this_location()) = old_THIS; } while (0) |
920 | NULL, 0, NULL, NULL, NULL)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.c", __FUNCTION__, 920, 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 , 107, ((void*)0), 0, ((void*)0), ((void*)0), ((void*)0)); (* __glusterfs_this_location()) = old_THIS; } while (0); |
921 | |
922 | return 0; |
923 | } |
924 | |
925 | |
926 | |
927 | |
928 | int32_t |
929 | client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, |
930 | struct iovec *vector, int32_t count, off_t off, |
931 | uint32_t flags, struct iobref *iobref, dict_t *xdata) |
932 | { |
933 | int ret = -1; |
934 | clnt_conf_t *conf = NULL((void*)0); |
935 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
936 | clnt_args_t args = {0,}; |
937 | |
938 | conf = this->private; |
939 | if (!conf || !conf->fops) |
940 | goto out; |
941 | |
942 | args.fd = fd; |
943 | args.vector = vector; |
944 | args.count = count; |
945 | args.offset = off; |
946 | args.flags = flags; |
947 | args.iobref = iobref; |
948 | args.xdata = xdata; |
949 | |
950 | proc = &conf->fops->proctable[GF_FOP_WRITE]; |
951 | if (!proc) { |
952 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_WRITE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 954, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_WRITE]); } while (0) |
953 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_WRITE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 954, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_WRITE]); } while (0) |
954 | gf_fop_list[GF_FOP_WRITE])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_WRITE]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 954, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_WRITE]); } while (0); |
955 | goto out; |
956 | } |
957 | if (proc->fn) |
958 | ret = proc->fn (frame, this, &args); |
959 | out: |
960 | if (ret) |
961 | STACK_UNWIND_STRICT (writev, frame, -1, ENOTCONN, NULL, NULL, NULL)do { fop_writev_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 961, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
962 | |
963 | return 0; |
964 | } |
965 | |
966 | |
967 | int32_t |
968 | client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) |
969 | { |
970 | int ret = -1; |
971 | clnt_conf_t *conf = NULL((void*)0); |
972 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
973 | clnt_args_t args = {0,}; |
974 | |
975 | conf = this->private; |
976 | if (!conf || !conf->fops) |
977 | goto out; |
978 | |
979 | args.fd = fd; |
980 | args.xdata = xdata; |
981 | |
982 | proc = &conf->fops->proctable[GF_FOP_FLUSH]; |
983 | if (!proc) { |
984 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FLUSH]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 986, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FLUSH]); } while (0) |
985 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FLUSH]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 986, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FLUSH]); } while (0) |
986 | gf_fop_list[GF_FOP_FLUSH])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FLUSH]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 986, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FLUSH]); } while (0); |
987 | goto out; |
988 | } |
989 | if (proc->fn) |
990 | ret = proc->fn (frame, this, &args); |
991 | out: |
992 | if (ret) |
993 | STACK_UNWIND_STRICT (flush, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 993, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
994 | |
995 | return 0; |
996 | } |
997 | |
998 | |
999 | |
1000 | int32_t |
1001 | client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1002 | int32_t flags, dict_t *xdata) |
1003 | { |
1004 | int ret = -1; |
1005 | clnt_conf_t *conf = NULL((void*)0); |
1006 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1007 | clnt_args_t args = {0,}; |
1008 | |
1009 | conf = this->private; |
1010 | if (!conf || !conf->fops) |
1011 | goto out; |
1012 | |
1013 | args.fd = fd; |
1014 | args.flags = flags; |
1015 | args.xdata = xdata; |
1016 | |
1017 | proc = &conf->fops->proctable[GF_FOP_FSYNC]; |
1018 | if (!proc) { |
1019 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSYNC]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1021, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSYNC]); } while (0) |
1020 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSYNC]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1021, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSYNC]); } while (0) |
1021 | gf_fop_list[GF_FOP_FSYNC])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSYNC]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1021, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSYNC]); } while (0); |
1022 | goto out; |
1023 | } |
1024 | if (proc->fn) |
1025 | ret = proc->fn (frame, this, &args); |
1026 | out: |
1027 | if (ret) |
1028 | STACK_UNWIND_STRICT (fsync, frame, -1, ENOTCONN, NULL, NULL, NULL)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.c", __FUNCTION__, 1028, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1029 | |
1030 | return 0; |
1031 | } |
1032 | |
1033 | |
1034 | |
1035 | int32_t |
1036 | client_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) |
1037 | { |
1038 | int ret = -1; |
1039 | clnt_conf_t *conf = NULL((void*)0); |
1040 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1041 | clnt_args_t args = {0,}; |
1042 | |
1043 | conf = this->private; |
1044 | if (!conf || !conf->fops) |
1045 | goto out; |
1046 | |
1047 | args.fd = fd; |
1048 | args.xdata = xdata; |
1049 | |
1050 | proc = &conf->fops->proctable[GF_FOP_FSTAT]; |
1051 | if (!proc) { |
1052 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSTAT]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1054, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSTAT]); } while (0) |
1053 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSTAT]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1054, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSTAT]); } while (0) |
1054 | gf_fop_list[GF_FOP_FSTAT])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSTAT]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1054, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSTAT]); } while (0); |
1055 | goto out; |
1056 | } |
1057 | if (proc->fn) |
1058 | ret = proc->fn (frame, this, &args); |
1059 | out: |
1060 | if (ret) |
1061 | STACK_UNWIND_STRICT (fstat, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1061, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1062 | |
1063 | return 0; |
1064 | } |
1065 | |
1066 | |
1067 | |
1068 | int32_t |
1069 | client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, |
1070 | dict_t *xdata) |
1071 | { |
1072 | int ret = -1; |
1073 | clnt_conf_t *conf = NULL((void*)0); |
1074 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1075 | clnt_args_t args = {0,}; |
1076 | |
1077 | conf = this->private; |
1078 | if (!conf || !conf->fops) |
1079 | goto out; |
1080 | |
1081 | args.loc = loc; |
1082 | args.fd = fd; |
1083 | args.xdata = xdata; |
1084 | |
1085 | proc = &conf->fops->proctable[GF_FOP_OPENDIR]; |
1086 | if (!proc) { |
1087 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_OPENDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1089, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_OPENDIR]); } while (0) |
1088 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_OPENDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1089, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_OPENDIR]); } while (0) |
1089 | gf_fop_list[GF_FOP_OPENDIR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_OPENDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1089, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_OPENDIR]); } while (0); |
1090 | goto out; |
1091 | } |
1092 | if (proc->fn) |
1093 | ret = proc->fn (frame, this, &args); |
1094 | out: |
1095 | if (ret) |
1096 | STACK_UNWIND_STRICT (opendir, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1096, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1097 | |
1098 | return 0; |
1099 | } |
1100 | |
1101 | |
1102 | |
1103 | int32_t |
1104 | client_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) |
1105 | { |
1106 | int ret = -1; |
1107 | clnt_conf_t *conf = NULL((void*)0); |
1108 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1109 | clnt_args_t args = {0,}; |
1110 | |
1111 | conf = this->private; |
1112 | if (!conf || !conf->fops) |
1113 | goto out; |
1114 | |
1115 | args.fd = fd; |
1116 | args.flags = flags; |
1117 | args.xdata = xdata; |
1118 | |
1119 | proc = &conf->fops->proctable[GF_FOP_FSYNCDIR]; |
1120 | if (!proc) { |
1121 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSYNCDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1123, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSYNCDIR]); } while (0) |
1122 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSYNCDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1123, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSYNCDIR]); } while (0) |
1123 | gf_fop_list[GF_FOP_FSYNCDIR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSYNCDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1123, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSYNCDIR]); } while (0); |
1124 | goto out; |
1125 | } |
1126 | if (proc->fn) |
1127 | ret = proc->fn (frame, this, &args); |
1128 | out: |
1129 | if (ret) |
1130 | STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 1130, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1131 | |
1132 | return 0; |
1133 | } |
1134 | |
1135 | |
1136 | |
1137 | int32_t |
1138 | client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) |
1139 | { |
1140 | int ret = -1; |
1141 | clnt_conf_t *conf = NULL((void*)0); |
1142 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1143 | clnt_args_t args = {0,}; |
1144 | |
1145 | conf = this->private; |
1146 | if (!conf || !conf->fops) |
1147 | goto out; |
1148 | |
1149 | args.loc = loc; |
1150 | args.xdata = xdata; |
1151 | |
1152 | proc = &conf->fops->proctable[GF_FOP_STATFS]; |
1153 | if (!proc) { |
1154 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_STATFS]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1156, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_STATFS]); } while (0) |
1155 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_STATFS]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1156, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_STATFS]); } while (0) |
1156 | gf_fop_list[GF_FOP_STATFS])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_STATFS]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1156, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_STATFS]); } while (0); |
1157 | goto out; |
1158 | } |
1159 | if (proc->fn) |
1160 | ret = proc->fn (frame, this, &args); |
1161 | out: |
1162 | if (ret) |
1163 | STACK_UNWIND_STRICT (statfs, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1163, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1164 | |
1165 | return 0; |
1166 | } |
1167 | |
1168 | static gf_boolean_t |
1169 | is_client_rpc_init_command (dict_t *dict, xlator_t *this, |
1170 | char **value) |
1171 | { |
1172 | gf_boolean_t ret = _gf_false; |
1173 | int dict_ret = -1; |
1174 | |
1175 | if (!strstr (this->name, "replace-brick")) { |
1176 | gf_log (this->name, GF_LOG_TRACE, "name is !replace-brick")do { do { if (0) printf ("name is !replace-brick"); } while ( 0); _gf_log (this->name, "client.c", __FUNCTION__, 1176, GF_LOG_TRACE , "name is !replace-brick"); } while (0); |
1177 | goto out; |
1178 | } |
1179 | dict_ret = dict_get_str (dict, CLIENT_CMD_CONNECT"trusted.glusterfs.client-connect", value); |
1180 | if (dict_ret) { |
1181 | gf_log (this->name, GF_LOG_TRACE, "key %s not present",do { do { if (0) printf ("key %s not present", "trusted.glusterfs.client-connect" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1182, GF_LOG_TRACE, "key %s not present", "trusted.glusterfs.client-connect" ); } while (0) |
1182 | CLIENT_CMD_CONNECT)do { do { if (0) printf ("key %s not present", "trusted.glusterfs.client-connect" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1182, GF_LOG_TRACE, "key %s not present", "trusted.glusterfs.client-connect" ); } while (0); |
1183 | goto out; |
1184 | } |
1185 | |
1186 | ret = _gf_true; |
1187 | |
1188 | out: |
1189 | return ret; |
1190 | |
1191 | } |
1192 | |
1193 | static gf_boolean_t |
1194 | is_client_rpc_destroy_command (dict_t *dict, xlator_t *this) |
1195 | { |
1196 | gf_boolean_t ret = _gf_false; |
1197 | int dict_ret = -1; |
1198 | char *dummy = NULL((void*)0); |
1199 | |
1200 | if (strncmp (this->name, "replace-brick", 13)) { |
1201 | gf_log (this->name, GF_LOG_TRACE, "name is !replace-brick")do { do { if (0) printf ("name is !replace-brick"); } while ( 0); _gf_log (this->name, "client.c", __FUNCTION__, 1201, GF_LOG_TRACE , "name is !replace-brick"); } while (0); |
1202 | goto out; |
1203 | } |
1204 | |
1205 | dict_ret = dict_get_str (dict, CLIENT_CMD_DISCONNECT"trusted.glusterfs.client-disconnect", &dummy); |
1206 | if (dict_ret) { |
1207 | gf_log (this->name, GF_LOG_TRACE, "key %s not present",do { do { if (0) printf ("key %s not present", "trusted.glusterfs.client-disconnect" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1208, GF_LOG_TRACE, "key %s not present", "trusted.glusterfs.client-disconnect" ); } while (0) |
1208 | CLIENT_CMD_DISCONNECT)do { do { if (0) printf ("key %s not present", "trusted.glusterfs.client-disconnect" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1208, GF_LOG_TRACE, "key %s not present", "trusted.glusterfs.client-disconnect" ); } while (0); |
1209 | goto out; |
1210 | } |
1211 | |
1212 | ret = _gf_true; |
1213 | |
1214 | out: |
1215 | return ret; |
1216 | |
1217 | } |
1218 | |
1219 | static gf_boolean_t |
1220 | client_set_remote_options (char *value, xlator_t *this) |
1221 | { |
1222 | char *dup_value = NULL((void*)0); |
1223 | char *host = NULL((void*)0); |
1224 | char *subvol = NULL((void*)0); |
1225 | char *host_dup = NULL((void*)0); |
1226 | char *subvol_dup = NULL((void*)0); |
1227 | char *remote_port_str = NULL((void*)0); |
1228 | char *tmp = NULL((void*)0); |
1229 | int remote_port = 0; |
1230 | gf_boolean_t ret = _gf_false; |
1231 | |
1232 | dup_value = gf_strdup (value); |
1233 | host = strtok_r (dup_value, ":", &tmp); |
1234 | subvol = strtok_r (NULL((void*)0), ":", &tmp); |
1235 | remote_port_str = strtok_r (NULL((void*)0), ":", &tmp); |
1236 | |
1237 | if (!subvol) { |
1238 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("proper value not passed as subvolume" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1239, GF_LOG_WARNING, "proper value not passed as subvolume" ); } while (0) |
1239 | "proper value not passed as subvolume")do { do { if (0) printf ("proper value not passed as subvolume" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1239, GF_LOG_WARNING, "proper value not passed as subvolume" ); } while (0); |
1240 | goto out; |
1241 | } |
1242 | |
1243 | host_dup = gf_strdup (host); |
1244 | if (!host_dup) { |
1245 | goto out; |
1246 | } |
1247 | |
1248 | ret = dict_set_dynstr (this->options, "remote-host", host_dup); |
1249 | if (ret) { |
1250 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("failed to set remote-host with %s", host); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1251, GF_LOG_WARNING, "failed to set remote-host with %s", host ); } while (0) |
1251 | "failed to set remote-host with %s", host)do { do { if (0) printf ("failed to set remote-host with %s", host); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1251, GF_LOG_WARNING, "failed to set remote-host with %s", host ); } while (0); |
1252 | goto out; |
1253 | } |
1254 | |
1255 | subvol_dup = gf_strdup (subvol); |
1256 | if (!subvol_dup) { |
1257 | goto out; |
1258 | } |
1259 | |
1260 | ret = dict_set_dynstr (this->options, "remote-subvolume", subvol_dup); |
1261 | if (ret) { |
1262 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("failed to set remote-host with %s", host); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1263, GF_LOG_WARNING, "failed to set remote-host with %s", host ); } while (0) |
1263 | "failed to set remote-host with %s", host)do { do { if (0) printf ("failed to set remote-host with %s", host); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1263, GF_LOG_WARNING, "failed to set remote-host with %s", host ); } while (0); |
1264 | goto out; |
1265 | } |
1266 | |
1267 | remote_port = atoi (remote_port_str); |
1268 | GF_ASSERT (remote_port)do { if (!(remote_port)) { do { do { if (0) printf ("Assertion failed: " "remote_port"); } while (0); _gf_log_callingfn ("", "client.c" , __FUNCTION__, 1268, GF_LOG_ERROR, "Assertion failed: " "remote_port" ); } while (0); } } while (0); |
1269 | |
1270 | ret = dict_set_int32 (this->options, "remote-port", |
1271 | remote_port); |
1272 | if (ret) { |
1273 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to set remote-port to %d", remote_port ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1274, GF_LOG_ERROR, "failed to set remote-port to %d", remote_port ); } while (0) |
1274 | "failed to set remote-port to %d", remote_port)do { do { if (0) printf ("failed to set remote-port to %d", remote_port ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 1274, GF_LOG_ERROR, "failed to set remote-port to %d", remote_port ); } while (0); |
1275 | goto out; |
1276 | } |
1277 | |
1278 | ret = _gf_true; |
1279 | out: |
1280 | GF_FREE (dup_value)__gf_free (dup_value); |
1281 | |
1282 | return ret; |
1283 | } |
1284 | |
1285 | |
1286 | int32_t |
1287 | client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, |
1288 | int32_t flags, dict_t *xdata) |
1289 | { |
1290 | int ret = -1; |
1291 | int op_ret = -1; |
1292 | int op_errno = ENOTCONN107; |
1293 | int need_unwind = 0; |
1294 | clnt_conf_t *conf = NULL((void*)0); |
1295 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1296 | clnt_args_t args = {0,}; |
1297 | char *value = NULL((void*)0); |
1298 | |
1299 | |
1300 | if (is_client_rpc_init_command (dict, this, &value) == _gf_true) { |
1301 | GF_ASSERT (value)do { if (!(value)) { do { do { if (0) printf ("Assertion failed: " "value"); } while (0); _gf_log_callingfn ("", "client.c", __FUNCTION__ , 1301, GF_LOG_ERROR, "Assertion failed: " "value"); } while ( 0); } } while (0); |
1302 | gf_log (this->name, GF_LOG_INFO, "client rpc init command")do { do { if (0) printf ("client rpc init command"); } while ( 0); _gf_log (this->name, "client.c", __FUNCTION__, 1302, GF_LOG_INFO , "client rpc init command"); } while (0); |
1303 | ret = client_set_remote_options (value, this); |
1304 | if (ret) { |
1305 | (void) client_destroy_rpc (this); |
1306 | ret = client_init_rpc (this); |
1307 | } |
1308 | |
1309 | if (!ret) { |
1310 | op_ret = 0; |
1311 | op_errno = 0; |
1312 | } |
1313 | need_unwind = 1; |
1314 | goto out; |
1315 | } |
1316 | |
1317 | if (is_client_rpc_destroy_command (dict, this) == _gf_true) { |
1318 | gf_log (this->name, GF_LOG_INFO, "client rpc destroy command")do { do { if (0) printf ("client rpc destroy command"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 1318, GF_LOG_INFO, "client rpc destroy command"); } while (0); |
1319 | ret = client_destroy_rpc (this); |
1320 | if (ret) { |
1321 | op_ret = 0; |
1322 | op_errno = 0; |
1323 | } |
1324 | need_unwind = 1; |
1325 | goto out; |
1326 | } |
1327 | |
1328 | conf = this->private; |
1329 | if (!conf || !conf->fops) { |
1330 | op_errno = ENOTCONN107; |
1331 | need_unwind = 1; |
1332 | goto out; |
1333 | } |
1334 | |
1335 | args.loc = loc; |
1336 | args.xattr = dict; |
1337 | args.flags = flags; |
1338 | args.xdata = xdata; |
1339 | |
1340 | proc = &conf->fops->proctable[GF_FOP_SETXATTR]; |
1341 | if (!proc) { |
1342 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1344, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SETXATTR]); } while (0) |
1343 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1344, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SETXATTR]); } while (0) |
1344 | gf_fop_list[GF_FOP_SETXATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1344, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SETXATTR]); } while (0); |
1345 | goto out; |
1346 | } |
1347 | if (proc->fn) { |
1348 | ret = proc->fn (frame, this, &args); |
1349 | if (ret) { |
1350 | need_unwind = 1; |
1351 | } |
1352 | } |
1353 | out: |
1354 | if (need_unwind) |
1355 | STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, NULL)do { fop_setxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 1355, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_setxattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, op_ret , op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1356 | |
1357 | return 0; |
1358 | } |
1359 | |
1360 | |
1361 | |
1362 | int32_t |
1363 | client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1364 | dict_t *dict, int32_t flags, dict_t *xdata) |
1365 | { |
1366 | int ret = -1; |
1367 | clnt_conf_t *conf = NULL((void*)0); |
1368 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1369 | clnt_args_t args = {0,}; |
1370 | |
1371 | conf = this->private; |
1372 | if (!conf || !conf->fops) |
1373 | goto out; |
1374 | |
1375 | args.fd = fd; |
1376 | args.xattr = dict; |
1377 | args.flags = flags; |
1378 | args.xdata = xdata; |
1379 | |
1380 | proc = &conf->fops->proctable[GF_FOP_FSETXATTR]; |
1381 | if (!proc) { |
1382 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1384, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSETXATTR]); } while (0) |
1383 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1384, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSETXATTR]); } while (0) |
1384 | gf_fop_list[GF_FOP_FSETXATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1384, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSETXATTR]); } while (0); |
1385 | goto out; |
1386 | } |
1387 | if (proc->fn) |
1388 | ret = proc->fn (frame, this, &args); |
1389 | out: |
1390 | if (ret) |
1391 | STACK_UNWIND_STRICT (fsetxattr, frame, -1, ENOTCONN, NULL)do { fop_fsetxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 1391, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1392 | |
1393 | return 0; |
1394 | } |
1395 | |
1396 | |
1397 | |
1398 | |
1399 | int32_t |
1400 | client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1401 | const char *name, dict_t *xdata) |
1402 | { |
1403 | int ret = -1; |
1404 | clnt_conf_t *conf = NULL((void*)0); |
1405 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1406 | clnt_args_t args = {0,}; |
1407 | |
1408 | conf = this->private; |
1409 | if (!conf || !conf->fops) |
1410 | goto out; |
1411 | |
1412 | args.fd = fd; |
1413 | args.name = name; |
1414 | args.xdata = xdata; |
1415 | |
1416 | proc = &conf->fops->proctable[GF_FOP_FGETXATTR]; |
1417 | if (!proc) { |
1418 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FGETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1420, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FGETXATTR]); } while (0) |
1419 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FGETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1420, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FGETXATTR]); } while (0) |
1420 | gf_fop_list[GF_FOP_FGETXATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FGETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1420, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FGETXATTR]); } while (0); |
1421 | goto out; |
1422 | } |
1423 | if (proc->fn) |
1424 | ret = proc->fn (frame, this, &args); |
1425 | out: |
1426 | if (ret) |
1427 | STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1427, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1428 | |
1429 | return 0; |
1430 | } |
1431 | |
1432 | |
1433 | |
1434 | int32_t |
1435 | client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, |
1436 | const char *name, dict_t *xdata) |
1437 | { |
1438 | int ret = -1; |
1439 | clnt_conf_t *conf = NULL((void*)0); |
1440 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1441 | clnt_args_t args = {0,}; |
1442 | |
1443 | conf = this->private; |
1444 | if (!conf || !conf->fops) |
1445 | goto out; |
1446 | |
1447 | args.name = name; |
1448 | args.loc = loc; |
1449 | args.xdata = xdata; |
1450 | |
1451 | proc = &conf->fops->proctable[GF_FOP_GETXATTR]; |
1452 | if (!proc) { |
1453 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_GETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1455, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_GETXATTR]); } while (0) |
1454 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_GETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1455, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_GETXATTR]); } while (0) |
1455 | gf_fop_list[GF_FOP_GETXATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_GETXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1455, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_GETXATTR]); } while (0); |
1456 | goto out; |
1457 | } |
1458 | if (proc->fn) |
1459 | ret = proc->fn (frame, this, &args); |
1460 | out: |
1461 | if (ret) |
1462 | STACK_UNWIND_STRICT (getxattr, frame, -1, ENOTCONN, NULL, NULL)do { fop_getxattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 1462, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_getxattr_cbk_t )frame->ret ; _parent = frame->parent; pthread_spin_lock (&frame-> root->stack_lock); { _parent->ref_count--; } pthread_spin_unlock (&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location ()); (*__glusterfs_this_location()) = _parent->this; frame ->complete = _gf_true; frame->unwind_from = __FUNCTION__ ; if (frame->this->ctx->measure_latency) gf_latency_end (frame); fn (_parent, frame->cookie, _parent->this, -1 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1463 | |
1464 | return 0; |
1465 | } |
1466 | |
1467 | |
1468 | |
1469 | int32_t |
1470 | client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, |
1471 | gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) |
1472 | { |
1473 | int ret = -1; |
1474 | clnt_conf_t *conf = NULL((void*)0); |
1475 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1476 | clnt_args_t args = {0,}; |
1477 | |
1478 | conf = this->private; |
1479 | if (!conf || !conf->fops) |
1480 | goto out; |
1481 | |
1482 | args.loc = loc; |
1483 | args.flags = flags; |
1484 | args.xattr = dict; |
1485 | args.xdata = xdata; |
1486 | |
1487 | proc = &conf->fops->proctable[GF_FOP_XATTROP]; |
1488 | if (!proc) { |
1489 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_XATTROP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1491, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_XATTROP]); } while (0) |
1490 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_XATTROP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1491, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_XATTROP]); } while (0) |
1491 | gf_fop_list[GF_FOP_XATTROP])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_XATTROP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1491, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_XATTROP]); } while (0); |
1492 | goto out; |
1493 | } |
1494 | if (proc->fn) |
1495 | ret = proc->fn (frame, this, &args); |
1496 | out: |
1497 | if (ret) |
1498 | STACK_UNWIND_STRICT (xattrop, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1498, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1499 | |
1500 | return 0; |
1501 | } |
1502 | |
1503 | |
1504 | |
1505 | int32_t |
1506 | client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1507 | gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) |
1508 | { |
1509 | int ret = -1; |
1510 | clnt_conf_t *conf = NULL((void*)0); |
1511 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1512 | clnt_args_t args = {0,}; |
1513 | |
1514 | conf = this->private; |
1515 | if (!conf || !conf->fops) |
1516 | goto out; |
1517 | |
1518 | args.fd = fd; |
1519 | args.flags = flags; |
1520 | args.xattr = dict; |
1521 | args.xdata = xdata; |
1522 | |
1523 | proc = &conf->fops->proctable[GF_FOP_FXATTROP]; |
1524 | if (!proc) { |
1525 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FXATTROP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1527, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FXATTROP]); } while (0) |
1526 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FXATTROP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1527, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FXATTROP]); } while (0) |
1527 | gf_fop_list[GF_FOP_FXATTROP])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FXATTROP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1527, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FXATTROP]); } while (0); |
1528 | goto out; |
1529 | } |
1530 | if (proc->fn) |
1531 | ret = proc->fn (frame, this, &args); |
1532 | out: |
1533 | if (ret) |
1534 | STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1534, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1535 | |
1536 | return 0; |
1537 | } |
1538 | |
1539 | |
1540 | |
1541 | int32_t |
1542 | client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, |
1543 | const char *name, dict_t *xdata) |
1544 | { |
1545 | int ret = -1; |
1546 | clnt_conf_t *conf = NULL((void*)0); |
1547 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1548 | clnt_args_t args = {0,}; |
1549 | |
1550 | conf = this->private; |
1551 | if (!conf || !conf->fops) |
1552 | goto out; |
1553 | |
1554 | args.name = name; |
1555 | args.loc = loc; |
1556 | args.xdata = xdata; |
1557 | |
1558 | proc = &conf->fops->proctable[GF_FOP_REMOVEXATTR]; |
1559 | if (!proc) { |
1560 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_REMOVEXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1562, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_REMOVEXATTR]); } while (0) |
1561 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_REMOVEXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1562, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_REMOVEXATTR]); } while (0) |
1562 | gf_fop_list[GF_FOP_REMOVEXATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_REMOVEXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1562, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_REMOVEXATTR]); } while (0); |
1563 | goto out; |
1564 | } |
1565 | if (proc->fn) |
1566 | ret = proc->fn (frame, this, &args); |
1567 | out: |
1568 | if (ret) |
1569 | STACK_UNWIND_STRICT (removexattr, frame, -1, ENOTCONN, NULL)do { fop_removexattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 1569, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1570 | |
1571 | return 0; |
1572 | } |
1573 | |
1574 | int32_t |
1575 | client_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1576 | const char *name, dict_t *xdata) |
1577 | { |
1578 | int ret = -1; |
1579 | clnt_conf_t *conf = NULL((void*)0); |
1580 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1581 | clnt_args_t args = {0,}; |
1582 | |
1583 | conf = this->private; |
1584 | if (!conf || !conf->fops) |
1585 | goto out; |
1586 | |
1587 | args.name = name; |
1588 | args.fd = fd; |
1589 | args.xdata = xdata; |
1590 | |
1591 | proc = &conf->fops->proctable[GF_FOP_FREMOVEXATTR]; |
1592 | if (!proc) { |
1593 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FREMOVEXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1595, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FREMOVEXATTR]); } while (0) |
1594 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FREMOVEXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1595, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FREMOVEXATTR]); } while (0) |
1595 | gf_fop_list[GF_FOP_FREMOVEXATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FREMOVEXATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1595, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FREMOVEXATTR]); } while (0); |
1596 | goto out; |
1597 | } |
1598 | if (proc->fn) |
1599 | ret = proc->fn (frame, this, &args); |
1600 | out: |
1601 | if (ret) |
1602 | STACK_UNWIND_STRICT (fremovexattr, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 1602, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1603 | |
1604 | return 0; |
1605 | } |
1606 | |
1607 | int32_t |
1608 | client_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, |
1609 | struct gf_flock *lock, dict_t *xdata) |
1610 | { |
1611 | int ret = -1; |
1612 | clnt_conf_t *conf = NULL((void*)0); |
1613 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1614 | clnt_args_t args = {0,}; |
1615 | |
1616 | conf = this->private; |
1617 | if (!conf || !conf->fops) |
1618 | goto out; |
1619 | |
1620 | args.fd = fd; |
1621 | args.cmd = cmd; |
1622 | args.flock = lock; |
1623 | args.xdata = xdata; |
1624 | |
1625 | proc = &conf->fops->proctable[GF_FOP_LK]; |
1626 | if (!proc) { |
1627 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1629, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LK]); } while (0) |
1628 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1629, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LK]); } while (0) |
1629 | gf_fop_list[GF_FOP_LK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_LK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1629, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_LK]); } while (0); |
1630 | goto out; |
1631 | } |
1632 | if (proc->fn) |
1633 | ret = proc->fn (frame, this, &args); |
1634 | out: |
1635 | if (ret) |
1636 | STACK_UNWIND_STRICT (lk, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1636, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1637 | |
1638 | return 0; |
1639 | } |
1640 | |
1641 | |
1642 | int32_t |
1643 | client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, |
1644 | loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata) |
1645 | { |
1646 | int ret = -1; |
1647 | clnt_conf_t *conf = NULL((void*)0); |
1648 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1649 | clnt_args_t args = {0,}; |
1650 | |
1651 | conf = this->private; |
1652 | if (!conf || !conf->fops) |
1653 | goto out; |
1654 | |
1655 | args.loc = loc; |
1656 | args.cmd = cmd; |
1657 | args.flock = lock; |
1658 | args.volume = volume; |
1659 | args.xdata = xdata; |
1660 | |
1661 | proc = &conf->fops->proctable[GF_FOP_INODELK]; |
1662 | if (!proc) { |
1663 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_INODELK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1665, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_INODELK]); } while (0) |
1664 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_INODELK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1665, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_INODELK]); } while (0) |
1665 | gf_fop_list[GF_FOP_INODELK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_INODELK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1665, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_INODELK]); } while (0); |
1666 | goto out; |
1667 | } |
1668 | if (proc->fn) |
1669 | ret = proc->fn (frame, this, &args); |
1670 | out: |
1671 | if (ret) |
1672 | STACK_UNWIND_STRICT (inodelk, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 1672, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1673 | |
1674 | return 0; |
1675 | } |
1676 | |
1677 | |
1678 | |
1679 | int32_t |
1680 | client_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, |
1681 | fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) |
1682 | { |
1683 | int ret = -1; |
1684 | clnt_conf_t *conf = NULL((void*)0); |
1685 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1686 | clnt_args_t args = {0,}; |
1687 | |
1688 | conf = this->private; |
1689 | if (!conf || !conf->fops) |
1690 | goto out; |
1691 | |
1692 | args.fd = fd; |
1693 | args.cmd = cmd; |
1694 | args.flock = lock; |
1695 | args.volume = volume; |
1696 | args.xdata = xdata; |
1697 | |
1698 | proc = &conf->fops->proctable[GF_FOP_FINODELK]; |
1699 | if (!proc) { |
1700 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FINODELK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1702, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FINODELK]); } while (0) |
1701 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FINODELK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1702, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FINODELK]); } while (0) |
1702 | gf_fop_list[GF_FOP_FINODELK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FINODELK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1702, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FINODELK]); } while (0); |
1703 | goto out; |
1704 | } |
1705 | if (proc->fn) |
1706 | ret = proc->fn (frame, this, &args); |
1707 | out: |
1708 | if (ret) |
1709 | STACK_UNWIND_STRICT (finodelk, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 1709, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1710 | |
1711 | return 0; |
1712 | } |
1713 | |
1714 | |
1715 | int32_t |
1716 | client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, |
1717 | loc_t *loc, const char *basename, entrylk_cmd cmd, |
1718 | entrylk_type type, dict_t *xdata) |
1719 | { |
1720 | int ret = -1; |
1721 | clnt_conf_t *conf = NULL((void*)0); |
1722 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1723 | clnt_args_t args = {0,}; |
1724 | |
1725 | conf = this->private; |
1726 | if (!conf || !conf->fops) |
1727 | goto out; |
1728 | |
1729 | args.loc = loc; |
1730 | args.basename = basename; |
1731 | args.type = type; |
1732 | args.volume = volume; |
1733 | args.cmd_entrylk = cmd; |
1734 | args.xdata = xdata; |
1735 | |
1736 | proc = &conf->fops->proctable[GF_FOP_ENTRYLK]; |
1737 | if (!proc) { |
1738 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_ENTRYLK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1740, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_ENTRYLK]); } while (0) |
1739 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_ENTRYLK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1740, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_ENTRYLK]); } while (0) |
1740 | gf_fop_list[GF_FOP_ENTRYLK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_ENTRYLK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1740, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_ENTRYLK]); } while (0); |
1741 | goto out; |
1742 | } |
1743 | if (proc->fn) |
1744 | ret = proc->fn (frame, this, &args); |
1745 | out: |
1746 | if (ret) |
1747 | STACK_UNWIND_STRICT (entrylk, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 1747, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1748 | |
1749 | return 0; |
1750 | } |
1751 | |
1752 | |
1753 | |
1754 | int32_t |
1755 | client_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, |
1756 | fd_t *fd, const char *basename, entrylk_cmd cmd, |
1757 | entrylk_type type, dict_t *xdata) |
1758 | { |
1759 | int ret = -1; |
1760 | clnt_conf_t *conf = NULL((void*)0); |
1761 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1762 | clnt_args_t args = {0,}; |
1763 | |
1764 | conf = this->private; |
1765 | if (!conf || !conf->fops) |
1766 | goto out; |
1767 | |
1768 | args.fd = fd; |
1769 | args.basename = basename; |
1770 | args.type = type; |
1771 | args.volume = volume; |
1772 | args.cmd_entrylk = cmd; |
1773 | args.xdata = xdata; |
1774 | |
1775 | proc = &conf->fops->proctable[GF_FOP_FENTRYLK]; |
1776 | if (!proc) { |
1777 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FENTRYLK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1779, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FENTRYLK]); } while (0) |
1778 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FENTRYLK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1779, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FENTRYLK]); } while (0) |
1779 | gf_fop_list[GF_FOP_FENTRYLK])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FENTRYLK]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1779, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FENTRYLK]); } while (0); |
1780 | goto out; |
1781 | } |
1782 | if (proc->fn) |
1783 | ret = proc->fn (frame, this, &args); |
1784 | out: |
1785 | if (ret) |
1786 | STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOTCONN, NULL)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.c", __FUNCTION__, 1786, 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 , 107, ((void*)0)); (*__glusterfs_this_location()) = old_THIS ; } while (0); |
1787 | |
1788 | return 0; |
1789 | } |
1790 | |
1791 | |
1792 | int32_t |
1793 | client_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, |
1794 | int32_t len, dict_t *xdata) |
1795 | { |
1796 | int ret = -1; |
1797 | clnt_conf_t *conf = NULL((void*)0); |
1798 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1799 | clnt_args_t args = {0,}; |
1800 | |
1801 | conf = this->private; |
1802 | if (!conf || !conf->fops) |
1803 | goto out; |
1804 | |
1805 | args.fd = fd; |
1806 | args.offset = offset; |
1807 | args.len = len; |
1808 | args.xdata = xdata; |
1809 | |
1810 | proc = &conf->fops->proctable[GF_FOP_RCHECKSUM]; |
1811 | if (!proc) { |
1812 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RCHECKSUM]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1814, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RCHECKSUM]); } while (0) |
1813 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RCHECKSUM]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1814, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RCHECKSUM]); } while (0) |
1814 | gf_fop_list[GF_FOP_RCHECKSUM])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_RCHECKSUM]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1814, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_RCHECKSUM]); } while (0); |
1815 | goto out; |
1816 | } |
1817 | if (proc->fn) |
1818 | ret = proc->fn (frame, this, &args); |
1819 | out: |
1820 | if (ret) |
1821 | STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOTCONN, 0, NULL, NULL)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.c", __FUNCTION__, 1821, 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 , 107, 0, ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1822 | |
1823 | return 0; |
1824 | } |
1825 | |
1826 | int32_t |
1827 | client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1828 | size_t size, off_t off, dict_t *xdata) |
1829 | { |
1830 | int ret = -1; |
1831 | clnt_conf_t *conf = NULL((void*)0); |
1832 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1833 | clnt_args_t args = {0,}; |
1834 | |
1835 | conf = this->private; |
1836 | if (!conf || !conf->fops) |
1837 | goto out; |
1838 | |
1839 | args.fd = fd; |
1840 | args.size = size; |
1841 | args.offset = off; |
1842 | args.xdata = xdata; |
1843 | |
1844 | proc = &conf->fops->proctable[GF_FOP_READDIR]; |
1845 | if (!proc) { |
1846 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1848, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READDIR]); } while (0) |
1847 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1848, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READDIR]); } while (0) |
1848 | gf_fop_list[GF_FOP_READDIR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READDIR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1848, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READDIR]); } while (0); |
1849 | goto out; |
1850 | } |
1851 | if (proc->fn) |
1852 | ret = proc->fn (frame, this, &args); |
1853 | out: |
1854 | if (ret) |
1855 | STACK_UNWIND_STRICT (readdir, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1855, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1856 | |
1857 | return 0; |
1858 | } |
1859 | |
1860 | |
1861 | int32_t |
1862 | client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1863 | size_t size, off_t off, dict_t *dict) |
1864 | { |
1865 | int ret = -1; |
1866 | clnt_conf_t *conf = NULL((void*)0); |
1867 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1868 | clnt_args_t args = {0,}; |
1869 | |
1870 | conf = this->private; |
1871 | if (!conf || !conf->fops) |
1872 | goto out; |
1873 | |
1874 | args.fd = fd; |
1875 | args.size = size; |
1876 | args.offset = off; |
1877 | args.xdata = dict; |
1878 | |
1879 | proc = &conf->fops->proctable[GF_FOP_READDIRP]; |
1880 | if (!proc) { |
1881 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READDIRP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1883, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READDIRP]); } while (0) |
1882 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READDIRP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1883, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READDIRP]); } while (0) |
1883 | gf_fop_list[GF_FOP_READDIRP])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_READDIRP]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1883, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_READDIRP]); } while (0); |
1884 | goto out; |
1885 | } |
1886 | if (proc->fn) |
1887 | ret = proc->fn (frame, this, &args); |
1888 | out: |
1889 | if (ret) |
1890 | STACK_UNWIND_STRICT (readdirp, frame, -1, ENOTCONN, NULL, NULL)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.c", __FUNCTION__, 1890, 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 , 107, ((void*)0), ((void*)0)); (*__glusterfs_this_location() ) = old_THIS; } while (0); |
1891 | |
1892 | return 0; |
1893 | } |
1894 | |
1895 | |
1896 | int32_t |
1897 | client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, |
1898 | struct iatt *stbuf, int32_t valid, dict_t *xdata) |
1899 | { |
1900 | int ret = -1; |
1901 | clnt_conf_t *conf = NULL((void*)0); |
1902 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1903 | clnt_args_t args = {0,}; |
1904 | |
1905 | conf = this->private; |
1906 | if (!conf || !conf->fops) |
1907 | goto out; |
1908 | |
1909 | args.loc = loc; |
1910 | args.stbuf = stbuf; |
1911 | args.valid = valid; |
1912 | args.xdata = xdata; |
1913 | |
1914 | proc = &conf->fops->proctable[GF_FOP_SETATTR]; |
1915 | if (!proc) { |
1916 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SETATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1918, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SETATTR]); } while (0) |
1917 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SETATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1918, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SETATTR]); } while (0) |
1918 | gf_fop_list[GF_FOP_SETATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_SETATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1918, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_SETATTR]); } while (0); |
1919 | goto out; |
1920 | } |
1921 | if (proc->fn) |
1922 | ret = proc->fn (frame, this, &args); |
1923 | out: |
1924 | if (ret) |
1925 | STACK_UNWIND_STRICT (setattr, frame, -1, ENOTCONN, NULL, NULL, NULL)do { fop_setattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 1925, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1926 | |
1927 | return 0; |
1928 | } |
1929 | |
1930 | int32_t |
1931 | client_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, |
1932 | struct iatt *stbuf, int32_t valid, dict_t *xdata) |
1933 | { |
1934 | int ret = -1; |
1935 | clnt_conf_t *conf = NULL((void*)0); |
1936 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1937 | clnt_args_t args = {0,}; |
1938 | |
1939 | conf = this->private; |
1940 | if (!conf || !conf->fops) |
1941 | goto out; |
1942 | |
1943 | args.fd = fd; |
1944 | args.stbuf = stbuf; |
1945 | args.valid = valid; |
1946 | args.xdata = xdata; |
1947 | |
1948 | proc = &conf->fops->proctable[GF_FOP_FSETATTR]; |
1949 | if (!proc) { |
1950 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSETATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1952, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSETATTR]); } while (0) |
1951 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSETATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1952, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSETATTR]); } while (0) |
1952 | gf_fop_list[GF_FOP_FSETATTR])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_FSETATTR]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1952, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_FSETATTR]); } while (0); |
1953 | goto out; |
1954 | } |
1955 | if (proc->fn) |
1956 | ret = proc->fn (frame, this, &args); |
1957 | out: |
1958 | if (ret) |
1959 | STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOTCONN, NULL, NULL, NULL)do { fop_fsetattr_cbk_t fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"); } while (0); _gf_log ("stack" , "client.c", __FUNCTION__, 1959, 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 , 107, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location ()) = old_THIS; } while (0); |
1960 | |
1961 | return 0; |
1962 | } |
1963 | |
1964 | |
1965 | int32_t |
1966 | client_getspec (call_frame_t *frame, xlator_t *this, const char *key, |
1967 | int32_t flags) |
1968 | { |
1969 | int ret = -1; |
1970 | clnt_conf_t *conf = NULL((void*)0); |
1971 | rpc_clnt_procedure_t *proc = NULL((void*)0); |
1972 | clnt_args_t args = {0,}; |
1973 | |
1974 | conf = this->private; |
1975 | if (!conf || !conf->fops || !conf->handshake) |
1976 | goto out; |
1977 | |
1978 | args.name = key; |
1979 | args.flags = flags; |
1980 | |
1981 | /* For all other xlators, getspec is an fop, hence its in fops table */ |
1982 | proc = &conf->fops->proctable[GF_FOP_GETSPEC]; |
1983 | if (!proc) { |
1984 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_GETSPEC]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1986, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_GETSPEC]); } while (0) |
1985 | "rpc procedure not found for %s",do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_GETSPEC]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1986, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_GETSPEC]); } while (0) |
1986 | gf_fop_list[GF_FOP_GETSPEC])do { do { if (0) printf ("rpc procedure not found for %s", gf_fop_list [GF_FOP_GETSPEC]); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 1986, GF_LOG_ERROR, "rpc procedure not found for %s" , gf_fop_list[GF_FOP_GETSPEC]); } while (0); |
1987 | goto out; |
1988 | } |
1989 | if (proc->fn) { |
1990 | /* But at protocol level, this is handshake */ |
1991 | ret = proc->fn (frame, this, &args); |
1992 | } |
1993 | out: |
1994 | if (ret) |
1995 | STACK_UNWIND_STRICT (getspec, frame, -1, EINVAL, NULL)do { fop_getspec_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.c", __FUNCTION__, 1995, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn = (fop_getspec_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 , 22, ((void*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0); |
1996 | |
1997 | return 0; |
1998 | } |
1999 | |
2000 | |
2001 | int |
2002 | client_mark_fd_bad (xlator_t *this) |
2003 | { |
2004 | clnt_conf_t *conf = NULL((void*)0); |
2005 | clnt_fd_ctx_t *tmp = NULL((void*)0), *fdctx = NULL((void*)0); |
2006 | |
2007 | conf = this->private; |
2008 | |
2009 | pthread_mutex_lock (&conf->lock); |
2010 | { |
2011 | list_for_each_entry_safe (fdctx, tmp, &conf->saved_fds,for (fdctx = ((typeof(*fdctx) *)((char *)((&conf->saved_fds )->next)-(unsigned long)(&((typeof(*fdctx) *)0)->sfd_pos ))), tmp = ((typeof(*fdctx) *)((char *)(fdctx->sfd_pos.next )-(unsigned long)(&((typeof(*fdctx) *)0)->sfd_pos))); & fdctx->sfd_pos != (&conf->saved_fds); fdctx = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp->sfd_pos.next)-(unsigned long)(&((typeof(*tmp) *)0)->sfd_pos)))) |
2012 | sfd_pos)for (fdctx = ((typeof(*fdctx) *)((char *)((&conf->saved_fds )->next)-(unsigned long)(&((typeof(*fdctx) *)0)->sfd_pos ))), tmp = ((typeof(*fdctx) *)((char *)(fdctx->sfd_pos.next )-(unsigned long)(&((typeof(*fdctx) *)0)->sfd_pos))); & fdctx->sfd_pos != (&conf->saved_fds); fdctx = tmp, tmp = ((typeof(*tmp) *)((char *)(tmp->sfd_pos.next)-(unsigned long)(&((typeof(*tmp) *)0)->sfd_pos)))) { |
2013 | fdctx->remote_fd = -1; |
2014 | } |
2015 | } |
2016 | pthread_mutex_unlock (&conf->lock); |
2017 | |
2018 | return 0; |
2019 | } |
2020 | |
2021 | |
2022 | int |
2023 | client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, |
2024 | void *data) |
2025 | { |
2026 | xlator_t *this = NULL((void*)0); |
2027 | char *handshake = NULL((void*)0); |
2028 | clnt_conf_t *conf = NULL((void*)0); |
2029 | int ret = 0; |
2030 | |
2031 | this = mydata; |
2032 | if (!this || !this->private) { |
2033 | gf_log ("client", GF_LOG_ERROR,do { do { if (0) printf ((this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0); _gf_log ("client", "client.c" , __FUNCTION__, 2036, GF_LOG_ERROR, (this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0) |
2034 | (this != NULL) ?do { do { if (0) printf ((this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0); _gf_log ("client", "client.c" , __FUNCTION__, 2036, GF_LOG_ERROR, (this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0) |
2035 | "private structure of the xlator is NULL":do { do { if (0) printf ((this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0); _gf_log ("client", "client.c" , __FUNCTION__, 2036, GF_LOG_ERROR, (this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0) |
2036 | "xlator is NULL")do { do { if (0) printf ((this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0); _gf_log ("client", "client.c" , __FUNCTION__, 2036, GF_LOG_ERROR, (this != ((void*)0)) ? "private structure of the xlator is NULL" : "xlator is NULL"); } while (0); |
2037 | goto out; |
2038 | } |
2039 | |
2040 | conf = this->private; |
2041 | |
2042 | switch (event) { |
2043 | case RPC_CLNT_CONNECT: |
2044 | { |
2045 | conf->connected = 1; |
2046 | // connect happened, send 'get_supported_versions' mop |
2047 | ret = dict_get_str (this->options, "disable-handshake", |
2048 | &handshake); |
2049 | |
2050 | gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT")do { do { if (0) printf ("got RPC_CLNT_CONNECT"); } while (0) ; _gf_log (this->name, "client.c", __FUNCTION__, 2050, GF_LOG_DEBUG , "got RPC_CLNT_CONNECT"); } while (0); |
2051 | |
2052 | if ((ret < 0) || (strcasecmp (handshake, "on"))) { |
2053 | ret = client_handshake (this, conf->rpc); |
2054 | if (ret) |
2055 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("handshake msg returned %d", ret); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2056, GF_LOG_WARNING, "handshake msg returned %d", ret); } while (0) |
2056 | "handshake msg returned %d", ret)do { do { if (0) printf ("handshake msg returned %d", ret); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2056, GF_LOG_WARNING, "handshake msg returned %d", ret); } while (0); |
2057 | } else { |
2058 | //conf->rpc->connected = 1; |
2059 | if (conf->last_sent_event != GF_EVENT_CHILD_UP) { |
2060 | ret = default_notify (this, GF_EVENT_CHILD_UP, |
2061 | NULL((void*)0)); |
2062 | if (ret) |
2063 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("CHILD_UP notify failed"); } while ( 0); _gf_log (this->name, "client.c", __FUNCTION__, 2064, GF_LOG_INFO , "CHILD_UP notify failed"); } while (0) |
2064 | "CHILD_UP notify failed")do { do { if (0) printf ("CHILD_UP notify failed"); } while ( 0); _gf_log (this->name, "client.c", __FUNCTION__, 2064, GF_LOG_INFO , "CHILD_UP notify failed"); } while (0); |
2065 | conf->last_sent_event = GF_EVENT_CHILD_UP; |
2066 | } |
2067 | } |
2068 | |
2069 | /* Cancel grace timer if set */ |
2070 | pthread_mutex_lock (&conf->lock); |
2071 | { |
2072 | conf->grace_timer_needed = _gf_true; |
2073 | |
2074 | if (conf->grace_timer) { |
2075 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Cancelling the grace timer"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2076, GF_LOG_WARNING, "Cancelling the grace timer"); } while (0) |
2076 | "Cancelling the grace timer")do { do { if (0) printf ("Cancelling the grace timer"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2076, GF_LOG_WARNING, "Cancelling the grace timer"); } while (0); |
2077 | |
2078 | gf_timer_call_cancel (this->ctx, |
2079 | conf->grace_timer); |
2080 | |
2081 | conf->grace_timer = NULL((void*)0); |
2082 | } |
2083 | } |
2084 | pthread_mutex_unlock (&conf->lock); |
2085 | |
2086 | break; |
2087 | } |
2088 | case RPC_CLNT_DISCONNECT: |
2089 | if (!conf->lk_heal) |
2090 | client_mark_fd_bad (this); |
2091 | else |
2092 | client_register_grace_timer (this, conf); |
2093 | |
2094 | if (!conf->skip_notify) { |
2095 | if (conf->connected) |
2096 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("disconnected"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2097, GF_LOG_INFO, "disconnected"); } while (0) |
2097 | "disconnected")do { do { if (0) printf ("disconnected"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2097, GF_LOG_INFO, "disconnected"); } while (0); |
2098 | |
2099 | /* If the CHILD_DOWN event goes to parent xlator |
2100 | multiple times, the logic of parent xlator notify |
2101 | may get screwed up.. (eg. CHILD_MODIFIED event in |
2102 | replicate), hence make sure events which are passed |
2103 | to parent are genuine */ |
2104 | if (conf->last_sent_event != GF_EVENT_CHILD_DOWN) { |
2105 | ret = default_notify (this, GF_EVENT_CHILD_DOWN, |
2106 | NULL((void*)0)); |
2107 | if (ret) |
2108 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("CHILD_DOWN notify failed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2109, GF_LOG_INFO, "CHILD_DOWN notify failed"); } while (0) |
2109 | "CHILD_DOWN notify failed")do { do { if (0) printf ("CHILD_DOWN notify failed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2109, GF_LOG_INFO, "CHILD_DOWN notify failed"); } while (0); |
2110 | conf->last_sent_event = GF_EVENT_CHILD_DOWN; |
2111 | } |
2112 | } else { |
2113 | if (conf->connected) |
2114 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("disconnected (skipped notify)"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2115, GF_LOG_DEBUG, "disconnected (skipped notify)"); } while (0) |
2115 | "disconnected (skipped notify)")do { do { if (0) printf ("disconnected (skipped notify)"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2115, GF_LOG_DEBUG, "disconnected (skipped notify)"); } while (0); |
2116 | } |
2117 | |
2118 | conf->connected = 0; |
2119 | conf->skip_notify = 0; |
2120 | |
2121 | if (conf->quick_reconnect) { |
2122 | conf->quick_reconnect = 0; |
2123 | rpc_clnt_start (conf->rpc); |
2124 | } |
2125 | |
2126 | break; |
2127 | |
2128 | default: |
2129 | gf_log (this->name, GF_LOG_TRACE,do { do { if (0) printf ("got some other RPC event %d", event ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2130, GF_LOG_TRACE, "got some other RPC event %d", event); } while (0) |
2130 | "got some other RPC event %d", event)do { do { if (0) printf ("got some other RPC event %d", event ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2130, GF_LOG_TRACE, "got some other RPC event %d", event); } while (0); |
2131 | |
2132 | break; |
2133 | } |
2134 | |
2135 | out: |
2136 | return 0; |
2137 | } |
2138 | |
2139 | |
2140 | int |
2141 | notify (xlator_t *this, int32_t event, void *data, ...) |
2142 | { |
2143 | clnt_conf_t *conf = NULL((void*)0); |
2144 | |
2145 | conf = this->private; |
2146 | if (!conf) |
2147 | return 0; |
2148 | |
2149 | switch (event) { |
2150 | case GF_EVENT_PARENT_UP: |
2151 | { |
2152 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("parent translators are ready, attempting connect " "on transport"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2154, GF_LOG_INFO, "parent translators are ready, attempting connect " "on transport"); } while (0) |
2153 | "parent translators are ready, attempting connect "do { do { if (0) printf ("parent translators are ready, attempting connect " "on transport"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2154, GF_LOG_INFO, "parent translators are ready, attempting connect " "on transport"); } while (0) |
2154 | "on transport")do { do { if (0) printf ("parent translators are ready, attempting connect " "on transport"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2154, GF_LOG_INFO, "parent translators are ready, attempting connect " "on transport"); } while (0); |
2155 | |
2156 | rpc_clnt_start (conf->rpc); |
2157 | break; |
2158 | } |
2159 | |
2160 | case GF_EVENT_PARENT_DOWN: |
2161 | gf_log (this->name, GF_LOG_INFO,do { do { if (0) printf ("current graph is no longer active, destroying " "rpc_client "); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2163, GF_LOG_INFO, "current graph is no longer active, destroying " "rpc_client "); } while (0) |
2162 | "current graph is no longer active, destroying "do { do { if (0) printf ("current graph is no longer active, destroying " "rpc_client "); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2163, GF_LOG_INFO, "current graph is no longer active, destroying " "rpc_client "); } while (0) |
2163 | "rpc_client ")do { do { if (0) printf ("current graph is no longer active, destroying " "rpc_client "); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2163, GF_LOG_INFO, "current graph is no longer active, destroying " "rpc_client "); } while (0); |
2164 | |
2165 | pthread_mutex_lock (&conf->lock); |
2166 | { |
2167 | conf->parent_down = 1; |
2168 | } |
2169 | pthread_mutex_unlock (&conf->lock); |
2170 | |
2171 | rpc_clnt_disable (conf->rpc); |
2172 | break; |
2173 | |
2174 | default: |
2175 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("got %d, calling default_notify ()", event); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2176, GF_LOG_DEBUG, "got %d, calling default_notify ()", event ); } while (0) |
2176 | "got %d, calling default_notify ()", event)do { do { if (0) printf ("got %d, calling default_notify ()", event); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2176, GF_LOG_DEBUG, "got %d, calling default_notify ()", event ); } while (0); |
2177 | |
2178 | default_notify (this, event, data); |
2179 | conf->last_sent_event = event; |
2180 | break; |
2181 | } |
2182 | |
2183 | return 0; |
2184 | } |
2185 | |
2186 | int |
2187 | build_client_config (xlator_t *this, clnt_conf_t *conf) |
2188 | { |
2189 | int ret = -1; |
2190 | |
2191 | if (!conf) |
2192 | goto out; |
2193 | |
2194 | GF_OPTION_INIT ("frame-timeout", conf->rpc_conf.rpc_timeout,do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "frame-timeout" , &(conf->rpc_conf.rpc_timeout)); if (val_ret) goto out ; } while (0) |
2195 | int32, out)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "frame-timeout" , &(conf->rpc_conf.rpc_timeout)); if (val_ret) goto out ; } while (0); |
2196 | |
2197 | GF_OPTION_INIT ("remote-port", conf->rpc_conf.remote_port,do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "remote-port" , &(conf->rpc_conf.remote_port)); if (val_ret) goto out ; } while (0) |
2198 | int32, out)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "remote-port" , &(conf->rpc_conf.remote_port)); if (val_ret) goto out ; } while (0); |
2199 | |
2200 | GF_OPTION_INIT ("ping-timeout", conf->opt.ping_timeout,do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "ping-timeout" , &(conf->opt.ping_timeout)); if (val_ret) goto out; } while (0) |
2201 | int32, out)do { int val_ret = 0; val_ret = xlator_option_init_int32 ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "ping-timeout" , &(conf->opt.ping_timeout)); if (val_ret) goto out; } while (0); |
2202 | |
2203 | GF_OPTION_INIT ("remote-subvolume", conf->opt.remote_subvolume,do { int val_ret = 0; val_ret = xlator_option_init_path ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "remote-subvolume" , &(conf->opt.remote_subvolume)); if (val_ret) goto out ; } while (0) |
2204 | path, out)do { int val_ret = 0; val_ret = xlator_option_init_path ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "remote-subvolume" , &(conf->opt.remote_subvolume)); if (val_ret) goto out ; } while (0); |
2205 | if (!conf->opt.remote_subvolume) |
2206 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("option 'remote-subvolume' not given" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2207, GF_LOG_WARNING, "option 'remote-subvolume' not given" ); } while (0) |
2207 | "option 'remote-subvolume' not given")do { do { if (0) printf ("option 'remote-subvolume' not given" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2207, GF_LOG_WARNING, "option 'remote-subvolume' not given" ); } while (0); |
2208 | |
2209 | GF_OPTION_INIT ("filter-O_DIRECT", conf->filter_o_direct,do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "filter-O_DIRECT" , &(conf->filter_o_direct)); if (val_ret) goto out; } while (0) |
2210 | bool, out)do { int val_ret = 0; val_ret = xlator_option_init_bool ((*__glusterfs_this_location ()), (*__glusterfs_this_location())->options, "filter-O_DIRECT" , &(conf->filter_o_direct)); if (val_ret) goto out; } while (0); |
2211 | |
2212 | ret = 0; |
2213 | out: |
2214 | return ret; |
2215 | } |
2216 | |
2217 | |
2218 | int32_t |
2219 | mem_acct_init (xlator_t *this) |
2220 | { |
2221 | int ret = -1; |
2222 | |
2223 | if (!this) |
2224 | return ret; |
2225 | |
2226 | ret = xlator_mem_acct_init (this, gf_client_mt_end + 1); |
2227 | |
2228 | if (ret != 0) { |
2229 | gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2230, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0) |
2230 | "failed")do { do { if (0) printf ("Memory accounting init" "failed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2230, GF_LOG_ERROR, "Memory accounting init" "failed"); } while (0); |
2231 | return ret; |
2232 | } |
2233 | |
2234 | return ret; |
2235 | } |
2236 | |
2237 | int |
2238 | client_destroy_rpc (xlator_t *this) |
2239 | { |
2240 | int ret = -1; |
2241 | clnt_conf_t *conf = NULL((void*)0); |
2242 | |
2243 | conf = this->private; |
2244 | if (!conf) |
2245 | goto out; |
2246 | |
2247 | if (conf->rpc) { |
2248 | /* cleanup the saved-frames before last unref */ |
2249 | rpc_clnt_connection_cleanup (&conf->rpc->conn); |
2250 | |
2251 | conf->rpc = rpc_clnt_unref (conf->rpc); |
2252 | ret = 0; |
2253 | gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("Client rpc conn destroyed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2254, GF_LOG_DEBUG, "Client rpc conn destroyed"); } while (0) |
2254 | "Client rpc conn destroyed")do { do { if (0) printf ("Client rpc conn destroyed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2254, GF_LOG_DEBUG, "Client rpc conn destroyed"); } while (0); |
2255 | goto out; |
2256 | } |
2257 | |
2258 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("RPC destroy called on already destroyed " "connection"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2260, GF_LOG_WARNING, "RPC destroy called on already destroyed " "connection"); } while (0) |
2259 | "RPC destroy called on already destroyed "do { do { if (0) printf ("RPC destroy called on already destroyed " "connection"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2260, GF_LOG_WARNING, "RPC destroy called on already destroyed " "connection"); } while (0) |
2260 | "connection")do { do { if (0) printf ("RPC destroy called on already destroyed " "connection"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2260, GF_LOG_WARNING, "RPC destroy called on already destroyed " "connection"); } while (0); |
2261 | |
2262 | out: |
2263 | return ret; |
2264 | } |
2265 | |
2266 | int |
2267 | client_init_rpc (xlator_t *this) |
2268 | { |
2269 | int ret = -1; |
2270 | clnt_conf_t *conf = NULL((void*)0); |
2271 | |
2272 | conf = this->private; |
2273 | |
2274 | if (conf->rpc) { |
2275 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("client rpc already init'ed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2276, GF_LOG_WARNING, "client rpc already init'ed"); } while (0) |
2276 | "client rpc already init'ed")do { do { if (0) printf ("client rpc already init'ed"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2276, GF_LOG_WARNING, "client rpc already init'ed"); } while (0); |
2277 | ret = -1; |
2278 | goto out; |
2279 | } |
2280 | |
2281 | conf->rpc = rpc_clnt_new (this->options, this->ctx, this->name, 0); |
2282 | if (!conf->rpc) { |
2283 | gf_log (this->name, GF_LOG_ERROR, "failed to initialize RPC")do { do { if (0) printf ("failed to initialize RPC"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2283, GF_LOG_ERROR, "failed to initialize RPC"); } while (0); |
2284 | goto out; |
2285 | } |
2286 | |
2287 | ret = rpc_clnt_register_notify (conf->rpc, client_rpc_notify, this); |
2288 | if (ret) { |
2289 | gf_log (this->name, GF_LOG_ERROR, "failed to register notify")do { do { if (0) printf ("failed to register notify"); } while (0); _gf_log (this->name, "client.c", __FUNCTION__, 2289, GF_LOG_ERROR, "failed to register notify"); } while (0); |
2290 | goto out; |
2291 | } |
2292 | |
2293 | conf->handshake = &clnt_handshake_prog; |
2294 | conf->dump = &clnt_dump_prog; |
2295 | |
2296 | ret = rpcclnt_cbk_program_register (conf->rpc, &gluster_cbk_prog, |
2297 | this); |
2298 | if (ret) { |
2299 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to register callback program" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2300, GF_LOG_ERROR, "failed to register callback program"); } while (0) |
2300 | "failed to register callback program")do { do { if (0) printf ("failed to register callback program" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2300, GF_LOG_ERROR, "failed to register callback program"); } while (0); |
2301 | goto out; |
2302 | } |
2303 | |
2304 | ret = 0; |
2305 | |
2306 | gf_log (this->name, GF_LOG_DEBUG, "client init successful")do { do { if (0) printf ("client init successful"); } while ( 0); _gf_log (this->name, "client.c", __FUNCTION__, 2306, GF_LOG_DEBUG , "client init successful"); } while (0); |
2307 | out: |
2308 | return ret; |
2309 | } |
2310 | |
2311 | |
2312 | int |
2313 | client_init_grace_timer (xlator_t *this, dict_t *options, |
2314 | clnt_conf_t *conf) |
2315 | { |
2316 | char *lk_heal = NULL((void*)0); |
2317 | int32_t ret = -1; |
2318 | int32_t grace_timeout = -1; |
2319 | |
2320 | 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.c", __FUNCTION__, 2320, GF_LOG_ERROR, "invalid argument: " "this"); } while (0); goto out; } } while (0); |
2321 | GF_VALIDATE_OR_GOTO (this->name, options, out)do { if (!options) { (*__errno_location ()) = 22; do { do { if (0) printf ("invalid argument: " "options"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__, 2321, GF_LOG_ERROR , "invalid argument: " "options"); } while (0); goto out; } } while (0); |
2322 | GF_VALIDATE_OR_GOTO (this->name, conf, out)do { if (!conf) { (*__errno_location ()) = 22; do { do { if ( 0) printf ("invalid argument: " "conf"); } while (0); _gf_log_callingfn (this->name, "client.c", __FUNCTION__, 2322, GF_LOG_ERROR , "invalid argument: " "conf"); } while (0); goto out; } } while (0); |
2323 | |
2324 | conf->lk_heal = _gf_false; |
2325 | |
2326 | ret = dict_get_str (options, "lk-heal", &lk_heal); |
2327 | if (!ret) |
2328 | gf_string2boolean (lk_heal, &conf->lk_heal); |
2329 | |
2330 | gf_log (this->name, GF_LOG_DEBUG, "lk-heal = %s",do { do { if (0) printf ("lk-heal = %s", (conf->lk_heal) ? "on" : "off"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2331, GF_LOG_DEBUG, "lk-heal = %s", (conf-> lk_heal) ? "on" : "off"); } while (0) |
2331 | (conf->lk_heal) ? "on" : "off")do { do { if (0) printf ("lk-heal = %s", (conf->lk_heal) ? "on" : "off"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2331, GF_LOG_DEBUG, "lk-heal = %s", (conf-> lk_heal) ? "on" : "off"); } while (0); |
2332 | |
2333 | ret = dict_get_int32 (options, "grace-timeout", &grace_timeout); |
2334 | if (!ret) |
2335 | conf->grace_tv.tv_sec = grace_timeout; |
2336 | else |
2337 | conf->grace_tv.tv_sec = 10; |
2338 | |
2339 | conf->grace_tv.tv_usec = 0; |
2340 | |
2341 | gf_log (this->name, GF_LOG_DEBUG, "Client grace timeout "do { do { if (0) printf ("Client grace timeout " "value = %""ll" "u", conf->grace_tv.tv_sec); } while (0); _gf_log (this-> name, "client.c", __FUNCTION__, 2342, GF_LOG_DEBUG, "Client grace timeout " "value = %""ll" "u", conf->grace_tv.tv_sec); } while (0) |
2342 | "value = %"PRIu64, conf->grace_tv.tv_sec)do { do { if (0) printf ("Client grace timeout " "value = %""ll" "u", conf->grace_tv.tv_sec); } while (0); _gf_log (this-> name, "client.c", __FUNCTION__, 2342, GF_LOG_DEBUG, "Client grace timeout " "value = %""ll" "u", conf->grace_tv.tv_sec); } while (0); |
2343 | |
2344 | ret = 0; |
2345 | out: |
2346 | return ret; |
2347 | } |
2348 | |
2349 | int |
2350 | reconfigure (xlator_t *this, dict_t *options) |
2351 | { |
2352 | clnt_conf_t *conf = NULL((void*)0); |
2353 | int ret = -1; |
2354 | int subvol_ret = 0; |
2355 | char *old_remote_subvol = NULL((void*)0); |
2356 | char *new_remote_subvol = NULL((void*)0); |
2357 | char *old_remote_host = NULL((void*)0); |
2358 | char *new_remote_host = NULL((void*)0); |
2359 | |
2360 | conf = this->private; |
2361 | |
2362 | GF_OPTION_RECONF ("frame-timeout", conf->rpc_conf.rpc_timeout,do { int val_ret = 0; val_ret = xlator_option_reconf_int32 (( *__glusterfs_this_location()), options, "frame-timeout", & (conf->rpc_conf.rpc_timeout)); if (val_ret) goto out; } while (0) |
2363 | options, int32, out)do { int val_ret = 0; val_ret = xlator_option_reconf_int32 (( *__glusterfs_this_location()), options, "frame-timeout", & (conf->rpc_conf.rpc_timeout)); if (val_ret) goto out; } while (0); |
2364 | |
2365 | GF_OPTION_RECONF ("ping-timeout", conf->opt.ping_timeout,do { int val_ret = 0; val_ret = xlator_option_reconf_int32 (( *__glusterfs_this_location()), options, "ping-timeout", & (conf->opt.ping_timeout)); if (val_ret) goto out; } while ( 0) |
2366 | options, int32, out)do { int val_ret = 0; val_ret = xlator_option_reconf_int32 (( *__glusterfs_this_location()), options, "ping-timeout", & (conf->opt.ping_timeout)); if (val_ret) goto out; } while ( 0); |
2367 | |
2368 | subvol_ret = dict_get_str (this->options, "remote-host", |
2369 | &old_remote_host); |
2370 | |
2371 | if (subvol_ret == 0) { |
2372 | subvol_ret = dict_get_str (options, "remote-host", |
2373 | &new_remote_host); |
2374 | if (subvol_ret == 0) { |
2375 | if (strcmp (old_remote_host, new_remote_host)) { |
2376 | ret = 1; |
2377 | goto out; |
2378 | } |
2379 | } |
2380 | } |
2381 | |
2382 | subvol_ret = dict_get_str (this->options, "remote-subvolume", |
2383 | &old_remote_subvol); |
2384 | |
2385 | if (subvol_ret == 0) { |
2386 | subvol_ret = dict_get_str (options, "remote-subvolume", |
2387 | &new_remote_subvol); |
2388 | if (subvol_ret == 0) { |
2389 | if (strcmp (old_remote_subvol, new_remote_subvol)) { |
2390 | ret = 1; |
2391 | goto out; |
2392 | } |
2393 | } |
2394 | } |
2395 | |
2396 | GF_OPTION_RECONF ("filter-O_DIRECT", conf->filter_o_direct,do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "filter-O_DIRECT", & (conf->filter_o_direct)); if (val_ret) goto out; } while ( 0) |
2397 | options, bool, out)do { int val_ret = 0; val_ret = xlator_option_reconf_bool ((* __glusterfs_this_location()), options, "filter-O_DIRECT", & (conf->filter_o_direct)); if (val_ret) goto out; } while ( 0); |
2398 | |
2399 | ret = client_init_grace_timer (this, options, conf); |
2400 | if (ret) |
2401 | goto out; |
2402 | |
2403 | ret = 0; |
2404 | out: |
2405 | return ret; |
2406 | |
2407 | } |
2408 | |
2409 | |
2410 | int |
2411 | init (xlator_t *this) |
2412 | { |
2413 | int ret = -1; |
2414 | clnt_conf_t *conf = NULL((void*)0); |
2415 | |
2416 | if (this->children) { |
2417 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("FATAL: client protocol translator cannot have any " "subvolumes"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2419, GF_LOG_ERROR, "FATAL: client protocol translator cannot have any " "subvolumes"); } while (0) |
2418 | "FATAL: client protocol translator cannot have any "do { do { if (0) printf ("FATAL: client protocol translator cannot have any " "subvolumes"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2419, GF_LOG_ERROR, "FATAL: client protocol translator cannot have any " "subvolumes"); } while (0) |
2419 | "subvolumes")do { do { if (0) printf ("FATAL: client protocol translator cannot have any " "subvolumes"); } while (0); _gf_log (this->name, "client.c" , __FUNCTION__, 2419, GF_LOG_ERROR, "FATAL: client protocol translator cannot have any " "subvolumes"); } while (0); |
2420 | goto out; |
2421 | } |
2422 | |
2423 | if (!this->parents) { |
2424 | gf_log (this->name, GF_LOG_WARNING,do { do { if (0) printf ("Volume is dangling. "); } while (0) ; _gf_log (this->name, "client.c", __FUNCTION__, 2425, GF_LOG_WARNING , "Volume is dangling. "); } while (0) |
2425 | "Volume is dangling. ")do { do { if (0) printf ("Volume is dangling. "); } while (0) ; _gf_log (this->name, "client.c", __FUNCTION__, 2425, GF_LOG_WARNING , "Volume is dangling. "); } while (0); |
2426 | } |
2427 | |
2428 | conf = GF_CALLOC (1, sizeof (*conf), gf_client_mt_clnt_conf_t)__gf_calloc (1, sizeof (*conf), gf_client_mt_clnt_conf_t); |
2429 | if (!conf) |
2430 | goto out; |
2431 | |
2432 | pthread_mutex_init (&conf->lock, NULL((void*)0)); |
2433 | INIT_LIST_HEAD (&conf->saved_fds)do { (&conf->saved_fds)->next = (&conf->saved_fds )->prev = &conf->saved_fds; } while (0); |
2434 | |
2435 | /* Initialize parameters for lock self healing*/ |
2436 | conf->lk_version = 1; |
2437 | conf->grace_timer = NULL((void*)0); |
2438 | conf->grace_timer_needed = _gf_true; |
2439 | |
2440 | ret = client_init_grace_timer (this, this->options, conf); |
2441 | if (ret) |
2442 | goto out; |
2443 | |
2444 | LOCK_INIT (&conf->rec_lock)pthread_spin_init (&conf->rec_lock, 0); |
2445 | |
2446 | conf->last_sent_event = -1; /* To start with we don't have any events */ |
2447 | |
2448 | this->private = conf; |
2449 | |
2450 | /* If it returns -1, then its a failure, if it returns +1 we need |
2451 | have to understand that 'this' is subvolume of a xlator which, |
2452 | will set the remote host and remote subvolume in a setxattr |
2453 | call. |
2454 | */ |
2455 | |
2456 | ret = build_client_config (this, conf); |
2457 | if (ret == -1) |
2458 | goto out; |
2459 | |
2460 | if (ret) { |
2461 | ret = 0; |
2462 | goto out; |
2463 | } |
2464 | |
2465 | this->local_pool = mem_pool_new (clnt_local_t, 64)mem_pool_new_fn (sizeof(clnt_local_t), 64, "clnt_local_t"); |
2466 | if (!this->local_pool) { |
2467 | ret = -1; |
2468 | gf_log (this->name, GF_LOG_ERROR,do { do { if (0) printf ("failed to create local_t's memory pool" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2469, GF_LOG_ERROR, "failed to create local_t's memory pool" ); } while (0) |
2469 | "failed to create local_t's memory pool")do { do { if (0) printf ("failed to create local_t's memory pool" ); } while (0); _gf_log (this->name, "client.c", __FUNCTION__ , 2469, GF_LOG_ERROR, "failed to create local_t's memory pool" ); } while (0); |
2470 | goto out; |
2471 | } |
2472 | |
2473 | ret = client_init_rpc (this); |
2474 | out: |
2475 | if (ret) |
2476 | this->fini (this); |
2477 | |
2478 | return ret; |
2479 | } |
2480 | |
2481 | void |
2482 | fini (xlator_t *this) |
2483 | { |
2484 | clnt_conf_t *conf = NULL((void*)0); |
2485 | |
2486 | conf = this->private; |
2487 | this->private = NULL((void*)0); |
2488 | |
2489 | if (conf) { |
2490 | if (conf->rpc) { |
2491 | /* cleanup the saved-frames before last unref */ |
2492 | rpc_clnt_connection_cleanup (&conf->rpc->conn); |
2493 | |
2494 | rpc_clnt_unref (conf->rpc); |
2495 | } |
2496 | |
2497 | /* Saved Fds */ |
2498 | /* TODO: */ |
2499 | |
2500 | pthread_mutex_destroy (&conf->lock); |
2501 | |
2502 | GF_FREE (conf)__gf_free (conf); |
2503 | } |
2504 | return; |
2505 | } |
2506 | |
2507 | static void |
2508 | client_fd_lk_ctx_dump (xlator_t *this, fd_lk_ctx_t *lk_ctx, int nth_fd) |
2509 | { |
2510 | gf_boolean_t use_try_lock = _gf_true; |
2511 | int ret = -1; |
2512 | int lock_no = 0; |
2513 | fd_lk_ctx_t *lk_ctx_ref = NULL((void*)0); |
2514 | fd_lk_ctx_node_t *plock = NULL((void*)0); |
2515 | char key[GF_DUMP_MAX_BUF_LEN4096] = {0,}; |
2516 | |
2517 | lk_ctx_ref = fd_lk_ctx_try_ref (lk_ctx); |
2518 | if (!lk_ctx_ref) |
2519 | return; |
2520 | |
2521 | ret = client_fd_lk_list_empty (lk_ctx_ref, (use_try_lock = _gf_true)); |
2522 | if (ret != 0) |
2523 | return; |
2524 | |
2525 | ret = TRY_LOCK (&lk_ctx_ref->lock)pthread_spin_trylock (&lk_ctx_ref->lock); |
2526 | if (ret) |
2527 | return; |
2528 | |
2529 | gf_proc_dump_write ("------","------"); |
2530 | |
2531 | lock_no = 0; |
2532 | list_for_each_entry (plock, &lk_ctx_ref->lk_list, next)for (plock = ((typeof(*plock) *)((char *)((&lk_ctx_ref-> lk_list)->next)-(unsigned long)(&((typeof(*plock) *)0) ->next))); &plock->next != (&lk_ctx_ref->lk_list ); plock = ((typeof(*plock) *)((char *)(plock->next.next)- (unsigned long)(&((typeof(*plock) *)0)->next)))) { |
2533 | snprintf (key, sizeof (key), "granted-posix-lock[%d]", |
2534 | lock_no++); |
2535 | gf_proc_dump_write (key, "owner = %s, cmd = %s " |
2536 | "fl_type = %s, fl_start = %" |
2537 | PRId64"ll" "d"", fl_end = %"PRId64"ll" "d" |
2538 | ", user_flock: l_type = %s, " |
2539 | "l_start = %"PRId64"ll" "d"", l_len = %"PRId64"ll" "d", |
2540 | lkowner_utoa (&plock->user_flock.l_owner), |
2541 | get_lk_cmd (plock->cmd)plock->cmd == 14 ? "F_SETLKW" : (plock->cmd == 13 ? "F_SETLK" : "F_GETLK"), |
2542 | get_lk_type (plock->fl_type)plock->fl_type == 2 ? "F_UNLCK" : (plock->fl_type == 0 ? "F_RDLCK" : "F_WRLCK"), |
2543 | plock->fl_start, plock->fl_end, |
2544 | get_lk_type (plock->user_flock.l_type)plock->user_flock.l_type == 2 ? "F_UNLCK" : (plock->user_flock .l_type == 0 ? "F_RDLCK" : "F_WRLCK"), |
2545 | plock->user_flock.l_start, |
2546 | plock->user_flock.l_len); |
2547 | } |
2548 | gf_proc_dump_write ("------","------"); |
2549 | |
2550 | UNLOCK (&lk_ctx_ref->lock)pthread_spin_unlock (&lk_ctx_ref->lock); |
2551 | fd_lk_ctx_unref (lk_ctx_ref); |
2552 | |
2553 | } |
2554 | |
2555 | int |
2556 | client_priv_dump (xlator_t *this) |
2557 | { |
2558 | clnt_conf_t *conf = NULL((void*)0); |
2559 | int ret = -1; |
2560 | clnt_fd_ctx_t *tmp = NULL((void*)0); |
2561 | int i = 0; |
2562 | char key[GF_DUMP_MAX_BUF_LEN4096]; |
2563 | char key_prefix[GF_DUMP_MAX_BUF_LEN4096]; |
2564 | |
2565 | if (!this) |
2566 | return -1; |
2567 | |
2568 | conf = this->private; |
2569 | if (!conf) |
2570 | return -1; |
2571 | |
2572 | ret = pthread_mutex_trylock(&conf->lock); |
2573 | if (ret) |
2574 | return -1; |
2575 | |
2576 | gf_proc_dump_build_key(key_prefix, "xlator.protocol.client",{ _gf_proc_dump_build_key(key_prefix, "xlator.protocol.client" , "%s.priv", this->name); } |
2577 | "%s.priv", this->name){ _gf_proc_dump_build_key(key_prefix, "xlator.protocol.client" , "%s.priv", this->name); }; |
2578 | |
2579 | gf_proc_dump_add_section(key_prefix); |
2580 | |
2581 | list_for_each_entry(tmp, &conf->saved_fds, sfd_pos)for (tmp = ((typeof(*tmp) *)((char *)((&conf->saved_fds )->next)-(unsigned long)(&((typeof(*tmp) *)0)->sfd_pos ))); &tmp->sfd_pos != (&conf->saved_fds); tmp = ((typeof(*tmp) *)((char *)(tmp->sfd_pos.next)-(unsigned long )(&((typeof(*tmp) *)0)->sfd_pos)))) { |
2582 | sprintf (key, "fd.%d.remote_fd", i); |
2583 | gf_proc_dump_write(key, "%d", tmp->remote_fd); |
2584 | client_fd_lk_ctx_dump (this, tmp->lk_ctx, i); |
2585 | i++; |
2586 | } |
2587 | |
2588 | gf_proc_dump_write("connecting", "%d", conf->connecting); |
2589 | |
2590 | if (conf->rpc) { |
2591 | gf_proc_dump_write("total_bytes_read", "%"PRIu64"ll" "u", |
2592 | conf->rpc->conn.trans->total_bytes_read); |
2593 | |
2594 | gf_proc_dump_write("total_bytes_written", "%"PRIu64"ll" "u", |
2595 | conf->rpc->conn.trans->total_bytes_write); |
2596 | } |
2597 | pthread_mutex_unlock(&conf->lock); |
2598 | |
2599 | return 0; |
2600 | |
2601 | } |
2602 | |
2603 | int32_t |
2604 | client_inodectx_dump (xlator_t *this, inode_t *inode) |
2605 | { |
2606 | if (!inode) |
2607 | return -1; |
2608 | |
2609 | if (!this) |
2610 | return -1; |
2611 | |
2612 | /*TODO*/ |
2613 | |
2614 | return 0; |
2615 | } |
2616 | |
2617 | |
2618 | |
2619 | |
2620 | struct xlator_cbks cbks = { |
2621 | .forget = client_forget, |
2622 | .release = client_release, |
2623 | .releasedir = client_releasedir |
2624 | }; |
2625 | |
2626 | struct xlator_fops fops = { |
2627 | .stat = client_stat, |
2628 | .readlink = client_readlink, |
2629 | .mknod = client_mknod, |
2630 | .mkdir = client_mkdir, |
2631 | .unlink = client_unlink, |
2632 | .rmdir = client_rmdir, |
2633 | .symlink = client_symlink, |
2634 | .rename = client_rename, |
2635 | .link = client_link, |
2636 | .truncate = client_truncate, |
2637 | .open = client_open, |
2638 | .readv = client_readv, |
2639 | .writev = client_writev, |
2640 | .statfs = client_statfs, |
2641 | .flush = client_flush, |
2642 | .fsync = client_fsync, |
2643 | .setxattr = client_setxattr, |
2644 | .getxattr = client_getxattr, |
2645 | .fsetxattr = client_fsetxattr, |
2646 | .fgetxattr = client_fgetxattr, |
2647 | .removexattr = client_removexattr, |
2648 | .fremovexattr = client_fremovexattr, |
2649 | .opendir = client_opendir, |
2650 | .readdir = client_readdir, |
2651 | .readdirp = client_readdirp, |
2652 | .fsyncdir = client_fsyncdir, |
2653 | .access = client_access, |
2654 | .ftruncate = client_ftruncate, |
2655 | .fstat = client_fstat, |
2656 | .create = client_create, |
2657 | .lk = client_lk, |
2658 | .inodelk = client_inodelk, |
2659 | .finodelk = client_finodelk, |
2660 | .entrylk = client_entrylk, |
2661 | .fentrylk = client_fentrylk, |
2662 | .lookup = client_lookup, |
2663 | .rchecksum = client_rchecksum, |
2664 | .xattrop = client_xattrop, |
2665 | .fxattrop = client_fxattrop, |
2666 | .setattr = client_setattr, |
2667 | .fsetattr = client_fsetattr, |
2668 | .getspec = client_getspec, |
2669 | }; |
2670 | |
2671 | |
2672 | struct xlator_dumpops dumpops = { |
2673 | .priv = client_priv_dump, |
2674 | .inodectx = client_inodectx_dump, |
2675 | }; |
2676 | |
2677 | |
2678 | struct volume_options options[] = { |
2679 | { .key = {"username"}, |
2680 | .type = GF_OPTION_TYPE_ANY |
2681 | }, |
2682 | { .key = {"password"}, |
2683 | .type = GF_OPTION_TYPE_ANY |
2684 | }, |
2685 | { .key = {"transport-type"}, |
2686 | .value = {"tcp", "socket", "ib-verbs", "unix", "ib-sdp", |
2687 | "tcp/client", "ib-verbs/client", "rdma"}, |
2688 | .type = GF_OPTION_TYPE_STR |
2689 | }, |
2690 | { .key = {"remote-host"}, |
2691 | .type = GF_OPTION_TYPE_INTERNET_ADDRESS |
2692 | }, |
2693 | { .key = {"remote-port"}, |
2694 | .type = GF_OPTION_TYPE_INT, |
2695 | }, |
2696 | { .key = {"remote-subvolume"}, |
2697 | .type = GF_OPTION_TYPE_ANY |
2698 | }, |
2699 | { .key = {"frame-timeout", |
2700 | "rpc-timeout" }, |
2701 | .type = GF_OPTION_TYPE_TIME, |
2702 | .min = 0, |
2703 | .max = 86400, |
2704 | .default_value = "1800", |
2705 | .description = "Time frame after which the (file) operation would be " |
2706 | "declared as dead, if the server does not respond for " |
2707 | "a particular (file) operation." |
2708 | }, |
2709 | { .key = {"ping-timeout"}, |
2710 | .type = GF_OPTION_TYPE_TIME, |
2711 | .min = 1, |
2712 | .max = 1013, |
2713 | .default_value = "42", |
2714 | .description = "Time duration for which the client waits to " |
2715 | "check if the server is responsive." |
2716 | }, |
2717 | { .key = {"client-bind-insecure"}, |
2718 | .type = GF_OPTION_TYPE_BOOL |
2719 | }, |
2720 | { .key = {"lk-heal"}, |
2721 | .type = GF_OPTION_TYPE_BOOL, |
2722 | .default_value = "off", |
2723 | .description = "Enables or disables the lock heal." |
2724 | }, |
2725 | { .key = {"grace-timeout"}, |
2726 | .type = GF_OPTION_TYPE_INT, |
2727 | .min = 10, |
2728 | .max = 1800, |
2729 | .description = "Sets the grace-timeout value. Valid range 10-1800." |
2730 | }, |
2731 | {.key = {"tcp-window-size"}, |
2732 | .type = GF_OPTION_TYPE_SIZET, |
2733 | .min = GF_MIN_SOCKET_WINDOW_SIZE(0), |
2734 | .max = GF_MAX_SOCKET_WINDOW_SIZE(1 * 1048576ULL), |
2735 | .description = "Specifies the window size for tcp socket." |
2736 | }, |
2737 | { .key = {"filter-O_DIRECT"}, |
2738 | .type = GF_OPTION_TYPE_BOOL, |
2739 | .default_value = "disable", |
2740 | .description = "If enabled, in open() and creat() calls, O_DIRECT " |
2741 | "flag will be filtered at the client protocol level so server will " |
2742 | "still continue to cache the file. This works similar to NFS's " |
2743 | "behavior of O_DIRECT", |
2744 | }, |
2745 | { .key = {NULL((void*)0)} }, |
2746 | }; |