Bug Summary

File:xlators/cluster/dht/src/dht-inode-read.c
Location:line 249, column 17
Description:Access to field 'op_ret' results in a dereference of a null pointer (loaded from variable 'local')

Annotated Source Code

1/*
2 Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3 This file is part of GlusterFS.
4
5 This file is licensed to you under your choice of the GNU Lesser
6 General Public License, version 3 or any later version (LGPLv3 or
7 later), or the GNU General Public License, version 2 (GPLv2), in all
8 cases as published by the Free Software Foundation.
9*/
10
11#ifndef _CONFIG_H
12#define _CONFIG_H
13#include "config.h"
14#endif
15
16#include "dht-common.h"
17
18int dht_access2 (xlator_t *this, call_frame_t *frame, int ret);
19int dht_readv2 (xlator_t *this, call_frame_t *frame, int ret);
20int dht_attr2 (xlator_t *this, call_frame_t *frame, int ret);
21int dht_open2 (xlator_t *this, call_frame_t *frame, int ret);
22int dht_flush2 (xlator_t *this, call_frame_t *frame, int ret);
23int dht_lk2 (xlator_t *this, call_frame_t *frame, int ret);
24int dht_fsync2 (xlator_t *this, call_frame_t *frame, int ret);
25
26int
27dht_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
28 int op_ret, int op_errno, fd_t *fd, dict_t *xdata)
29{
30 dht_local_t *local = NULL((void*)0);
31 call_frame_t *prev = NULL((void*)0);
32 int ret = 0;
33
34 local = frame->local;
35 prev = cookie;
36
37 local->op_errno = op_errno;
38 if ((op_ret == -1) && (op_errno != ENOENT2)) {
39 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 41, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
40 "subvolume %s returned -1 (%s)",do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 41, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
41 prev->this->name, strerror (op_errno))do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 41, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
;
42 goto out;
43 }
44
45 if (!op_ret || (local->call_cnt != 1))
46 goto out;
47
48 /* rebalance would have happened */
49 local->rebalance.target_op_fn = dht_open2;
50 ret = dht_rebalance_complete_check (this, frame);
51 if (!ret)
52 return 0;
53
54out:
55 DHT_STACK_UNWIND (open, frame, op_ret, op_errno, local->fd, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_open_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 55, 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, op_ret
, op_errno, local->fd, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
56
57 return 0;
58}
59
60int
61dht_open2 (xlator_t *this, call_frame_t *frame, int op_ret)
62{
63 dht_local_t *local = NULL((void*)0);
64 xlator_t *subvol = NULL((void*)0);
65 int op_errno = EINVAL22;
66
67 local = frame->local;
68 if (!local)
69 goto out;
70
71 op_errno = ENOENT2;
72 if (op_ret)
73 goto out;
74
75 local->call_cnt = 2;
76 subvol = local->cached_subvol;
77
78 STACK_WIND (frame, dht_open_cbk, subvol, subvol->fops->open,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 80,
GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof(
subvol->fops->open_cbk) tmp_cbk = dht_open_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->open"; _new->unwind_to = "dht_open_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->open); subvol->fops->open (_new, subvol, &
local->loc, local->rebalance.flags, local->fd, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
79 &local->loc, local->rebalance.flags, local->fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 80,
GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof(
subvol->fops->open_cbk) tmp_cbk = dht_open_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->open"; _new->unwind_to = "dht_open_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->open); subvol->fops->open (_new, subvol, &
local->loc, local->rebalance.flags, local->fd, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
80 NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 80,
GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof(
subvol->fops->open_cbk) tmp_cbk = dht_open_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->open"; _new->unwind_to = "dht_open_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->open); subvol->fops->open (_new, subvol, &
local->loc, local->rebalance.flags, local->fd, ((void
*)0)); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
81 return 0;
82
83out:
84 DHT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 84, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_stat_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
85 return 0;
86}
87
88int
89dht_open (call_frame_t *frame, xlator_t *this,
90 loc_t *loc, int flags, fd_t *fd, dict_t *xdata)
91{
92 xlator_t *subvol = NULL((void*)0);
93 int op_errno = -1;
94 dht_local_t *local = NULL((void*)0);
95
96 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 96, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
97 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 97, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
98 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 98, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
99
100 local = dht_local_init (frame, loc, fd, GF_FOP_OPEN);
101 if (!local) {
102 op_errno = ENOMEM12;
103 goto err;
104 }
105
106 subvol = local->cached_subvol;
107 if (!subvol) {
108 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 109, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
109 "no cached subvolume for fd=%p", fd)do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 109, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
;
110 op_errno = EINVAL22;
111 goto err;
112 }
113
114 local->rebalance.flags = flags;
115 local->call_cnt = 1;
116
117 STACK_WIND (frame, dht_open_cbk, subvol, subvol->fops->open,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 118
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->open_cbk) tmp_cbk = dht_open_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->open"; _new->unwind_to = "dht_open_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->open); subvol->fops->open (_new, subvol, loc, flags
, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while
(0)
118 loc, flags, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 118
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->open_cbk) tmp_cbk = dht_open_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->open"; _new->unwind_to = "dht_open_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->open); subvol->fops->open (_new, subvol, loc, flags
, fd, xdata); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
119
120 return 0;
121
122err:
123 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
124 DHT_STACK_UNWIND (open, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_open_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 124, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_open_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
125
126 return 0;
127}
128
129int
130dht_file_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
131 int op_ret, int op_errno, struct iatt *stbuf, dict_t *xdata)
132{
133 uint64_t tmp_subvol = 0;
134 dht_local_t *local = NULL((void*)0);
135 call_frame_t *prev = NULL((void*)0);
136 int ret = -1;
137
138 GF_VALIDATE_OR_GOTO ("dht", frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
("dht", "dht-inode-read.c", __FUNCTION__, 138, GF_LOG_ERROR,
"invalid argument: " "frame"); } while (0); goto err; } } while
(0)
;
139 GF_VALIDATE_OR_GOTO ("dht", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
("dht", "dht-inode-read.c", __FUNCTION__, 139, GF_LOG_ERROR,
"invalid argument: " "this"); } while (0); goto out; } } while
(0)
;
140 GF_VALIDATE_OR_GOTO ("dht", frame->local, out)do { if (!frame->local) { (*__errno_location ()) = 22; do {
do { if (0) printf ("invalid argument: " "frame->local");
} while (0); _gf_log_callingfn ("dht", "dht-inode-read.c", __FUNCTION__
, 140, GF_LOG_ERROR, "invalid argument: " "frame->local");
} while (0); goto out; } } while (0)
;
141 GF_VALIDATE_OR_GOTO ("dht", cookie, out)do { if (!cookie) { (*__errno_location ()) = 22; do { do { if
(0) printf ("invalid argument: " "cookie"); } while (0); _gf_log_callingfn
("dht", "dht-inode-read.c", __FUNCTION__, 141, GF_LOG_ERROR,
"invalid argument: " "cookie"); } while (0); goto out; } } while
(0)
;
142
143 local = frame->local;
144 prev = cookie;
145
146 if ((op_ret == -1) && (op_errno != ENOENT2)) {
147 local->op_errno = op_errno;
148 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 150, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
149 "subvolume %s returned -1 (%s)",do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 150, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
150 prev->this->name, strerror (op_errno))do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 150, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
;
151 goto out;
152 }
153
154 if (local->call_cnt != 1)
155 goto out;
156
157 /* Check if the rebalance phase2 is true */
158 if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (stbuf)( ((stbuf)->ia_type == IA_IFREG) && ((st_mode_from_ia
((stbuf)->ia_prot, (stbuf)->ia_type) & ~0170000) ==
(01000)))
) {
159 if (local->fd)
160 ret = fd_ctx_get (local->fd, this, &tmp_subvol);
161 if (ret) {
162 /* Phase 2 of migration */
163 local->rebalance.target_op_fn = dht_attr2;
164 ret = dht_rebalance_complete_check (this, frame);
165 } else {
166 /* value is already set in fd_ctx, that means no need
167 to check for whether its complete or not. */
168 dht_attr2 (this, frame, 0);
169 }
170 if (!ret)
171 return 0;
172 }
173
174out:
175 DHT_STRIP_PHASE1_FLAGS (stbuf)do { if ((stbuf) && ( ((stbuf)->ia_type == IA_IFREG
) && ((stbuf)->ia_prot.sticky == 1) && ((stbuf
)->ia_prot.sgid == 1))) { (stbuf)->ia_prot.sticky = 0; (
stbuf)->ia_prot.sgid = 0; } } while (0)
;
176 DHT_STACK_UNWIND (stat, frame, op_ret, op_errno, stbuf, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 176, 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, op_ret
, op_errno, stbuf, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
177err:
178 return 0;
179}
180
181int
182dht_attr2 (xlator_t *this, call_frame_t *frame, int op_ret)
183{
184 dht_local_t *local = NULL((void*)0);
185 xlator_t *subvol = NULL((void*)0);
186 int op_errno = EINVAL22;
187
188 local = frame->local;
189 if (!local)
190 goto out;
191
192 op_errno = local->op_errno;
193 if (op_ret == -1)
194 goto out;
195
196 subvol = local->cached_subvol;
197 local->call_cnt = 2;
198
199 if (local->fop == GF_FOP_FSTAT) {
200 STACK_WIND (frame, dht_file_attr_cbk, subvol,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 201
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_file_attr_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fstat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, local
->fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
201 subvol->fops->fstat, local->fd, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 201
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_file_attr_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fstat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, local
->fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
202 } else {
203 STACK_WIND (frame, dht_file_attr_cbk, subvol,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 204
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_file_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, &
local->loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
204 subvol->fops->stat, &local->loc, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 204
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_file_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, &
local->loc, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
205 }
206 return 0;
207
208out:
209 DHT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 209, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_stat_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
210 return 0;
211}
212
213int
214dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
215 int op_ret, int op_errno, struct iatt *stbuf, dict_t *xdata)
216{
217 dht_local_t *local = NULL((void*)0);
1
'local' initialized to a null pointer value
218 int this_call_cnt = 0;
219 call_frame_t *prev = NULL((void*)0);
220
221 GF_VALIDATE_OR_GOTO ("dht", frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
("dht", "dht-inode-read.c", __FUNCTION__, 221, GF_LOG_ERROR,
"invalid argument: " "frame"); } while (0); goto err; } } while
(0)
;
222 GF_VALIDATE_OR_GOTO ("dht", this, out)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
("dht", "dht-inode-read.c", __FUNCTION__, 222, GF_LOG_ERROR,
"invalid argument: " "this"); } while (0); goto out; } } while
(0)
;
223 GF_VALIDATE_OR_GOTO ("dht", frame->local, out)do { if (!frame->local) { (*__errno_location ()) = 22; do {
do { if (0) printf ("invalid argument: " "frame->local");
} while (0); _gf_log_callingfn ("dht", "dht-inode-read.c", __FUNCTION__
, 223, GF_LOG_ERROR, "invalid argument: " "frame->local");
} while (0); goto out; } } while (0)
;
224 GF_VALIDATE_OR_GOTO ("dht", cookie, out)do { if (!cookie) { (*__errno_location ()) = 22; do { do { if
(0) printf ("invalid argument: " "cookie"); } while (0); _gf_log_callingfn
("dht", "dht-inode-read.c", __FUNCTION__, 224, GF_LOG_ERROR,
"invalid argument: " "cookie"); } while (0); goto out; } } while
(0)
;
225
226 local = frame->local;
227 prev = cookie;
228
229 LOCK (&frame->lock)pthread_spin_lock (&frame->lock);
230 {
231 if (op_ret == -1) {
232 local->op_errno = op_errno;
233 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 235, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
234 "subvolume %s returned -1 (%s)",do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 235, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
235 prev->this->name, strerror (op_errno))do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 235, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
;
236
237 goto unlock;
238 }
239
240 dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
241
242 local->op_ret = 0;
243 }
244unlock:
245 UNLOCK (&frame->lock)pthread_spin_unlock (&frame->lock);
246out:
247 this_call_cnt = dht_frame_return (frame);
248 if (is_last_call (this_call_cnt)(this_call_cnt == 0)) {
2
Taking true branch
249 DHT_STACK_UNWIND (stat, frame, local->op_ret, local->op_errno,do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 250, 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, local
->op_ret, local->op_errno, &local->stbuf, xdata)
; (*__glusterfs_this_location()) = old_THIS; } while (0); dht_local_wipe
(__xl, __local); } while (0)
3
Within the expansion of the macro 'DHT_STACK_UNWIND':
a
Access to field 'op_ret' results in a dereference of a null pointer (loaded from variable 'local')
250 &local->stbuf, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 250, 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, local
->op_ret, local->op_errno, &local->stbuf, xdata)
; (*__glusterfs_this_location()) = old_THIS; } while (0); dht_local_wipe
(__xl, __local); } while (0)
;
251 }
252err:
253 return 0;
254}
255
256int
257dht_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
258{
259 xlator_t *subvol = NULL((void*)0);
260 int op_errno = -1;
261 dht_local_t *local = NULL((void*)0);
262 dht_layout_t *layout = NULL((void*)0);
263 int i = 0;
264 int call_cnt = 0;
265
266 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 266, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
267 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 267, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
268 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 268, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
269 VALIDATE_OR_GOTO (loc->inode, err)do { if (!loc->inode) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->inode"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 269, GF_LOG_WARNING, "invalid argument: "
"loc->inode"); } while (0); goto err; } } while (0)
;
270 VALIDATE_OR_GOTO (loc->path, err)do { if (!loc->path) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->path"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 270, GF_LOG_WARNING, "invalid argument: "
"loc->path"); } while (0); goto err; } } while (0)
;
271
272
273 local = dht_local_init (frame, loc, NULL((void*)0), GF_FOP_STAT);
274 if (!local) {
275 op_errno = ENOMEM12;
276 goto err;
277 }
278
279 layout = local->layout;
280 if (!layout) {
281 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no layout for path=%s", loc->path
); } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 282, GF_LOG_DEBUG, "no layout for path=%s", loc->path); }
while (0)
282 "no layout for path=%s", loc->path)do { do { if (0) printf ("no layout for path=%s", loc->path
); } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 282, GF_LOG_DEBUG, "no layout for path=%s", loc->path); }
while (0)
;
283 op_errno = EINVAL22;
284 goto err;
285 }
286
287 if (IA_ISREG (loc->inode->ia_type)(loc->inode->ia_type == IA_IFREG)) {
288 local->call_cnt = 1;
289
290 subvol = local->cached_subvol;
291
292 STACK_WIND (frame, dht_file_attr_cbk, subvol,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 293
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_file_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, loc, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0)
293 subvol->fops->stat, loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 293
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_file_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, loc, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
294
295 return 0;
296 }
297
298 local->call_cnt = call_cnt = layout->cnt;
299
300 for (i = 0; i < call_cnt; i++) {
301 subvol = layout->list[i].xlator;
302
303 STACK_WIND (frame, dht_attr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 305
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_attr_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, loc, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0)
304 subvol, subvol->fops->stat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 305
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_attr_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, loc, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0)
305 loc, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 305
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->stat_cbk) tmp_cbk = dht_attr_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->stat"; _new->unwind_to = "dht_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->stat); subvol->fops->stat (_new, subvol, loc, xdata
); (*__glusterfs_this_location()) = old_THIS; } while (0)
;
306 }
307
308 return 0;
309
310err:
311 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
312 DHT_STACK_UNWIND (stat, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_stat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 312, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_stat_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
313
314 return 0;
315}
316
317
318int
319dht_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
320{
321 xlator_t *subvol = NULL((void*)0);
322 int op_errno = -1;
323 dht_local_t *local = NULL((void*)0);
324 dht_layout_t *layout = NULL((void*)0);
325 int i = 0;
326 int call_cnt = 0;
327
328
329 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 329, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
330 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 330, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
331 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 331, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
332
333 local = dht_local_init (frame, NULL((void*)0), fd, GF_FOP_FSTAT);
334 if (!local) {
335 op_errno = ENOMEM12;
336 goto err;
337 }
338
339 layout = local->layout;
340 if (!layout) {
341 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no layout for fd=%p", fd); } while (
0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__,
342, GF_LOG_DEBUG, "no layout for fd=%p", fd); } while (0)
342 "no layout for fd=%p", fd)do { do { if (0) printf ("no layout for fd=%p", fd); } while (
0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__,
342, GF_LOG_DEBUG, "no layout for fd=%p", fd); } while (0)
;
343 op_errno = EINVAL22;
344 goto err;
345 }
346
347 if (IA_ISREG (fd->inode->ia_type)(fd->inode->ia_type == IA_IFREG)) {
348 local->call_cnt = 1;
349
350 subvol = local->cached_subvol;
351
352 STACK_WIND (frame, dht_file_attr_cbk, subvol,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 353
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_file_attr_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fstat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
353 subvol->fops->fstat, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 353
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_file_attr_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fstat"; _new->unwind_to = "dht_file_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
;
354
355 return 0;
356 }
357
358 local->call_cnt = call_cnt = layout->cnt;
359
360 for (i = 0; i < call_cnt; i++) {
361 subvol = layout->list[i].xlator;
362 STACK_WIND (frame, dht_attr_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 364
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fstat"; _new->unwind_to = "dht_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
363 subvol, subvol->fops->fstat,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 364
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fstat"; _new->unwind_to = "dht_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
364 fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 364
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fstat_cbk) tmp_cbk = dht_attr_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fstat"; _new->unwind_to = "dht_attr_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fstat); subvol->fops->fstat (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
;
365 }
366
367 return 0;
368
369err:
370 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
371 DHT_STACK_UNWIND (fstat, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fstat_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 371, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_fstat_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
372
373 return 0;
374}
375
376int
377dht_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
378 int op_ret, int op_errno,
379 struct iovec *vector, int count, struct iatt *stbuf,
380 struct iobref *iobref, dict_t *xdata)
381{
382 dht_local_t *local = NULL((void*)0);
383 int ret = 0;
384
385 local = frame->local;
386 if (!local) {
387 op_ret = -1;
388 op_errno = EINVAL22;
389 goto out;
390 }
391
392 /* This is already second try, no need for re-check */
393 if (local->call_cnt != 1)
394 goto out;
395
396 if ((op_ret == -1) && (op_errno != ENOENT2))
397 goto out;
398
399 if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (stbuf)( ((stbuf)->ia_type == IA_IFREG) && ((st_mode_from_ia
((stbuf)->ia_prot, (stbuf)->ia_type) & ~0170000) ==
(01000)))
) {
400 /* File would be migrated to other node */
401 ret = fd_ctx_get (local->fd, this, NULL((void*)0));
402 if (ret) {
403 local->rebalance.target_op_fn = dht_readv2;
404 ret = dht_rebalance_complete_check (this, frame);
405 } else {
406 /* value is already set in fd_ctx, that means no need
407 to check for whether its complete or not. */
408 dht_readv2 (this, frame, 0);
409 }
410 if (!ret)
411 return 0;
412 }
413
414out:
415 DHT_STRIP_PHASE1_FLAGS (stbuf)do { if ((stbuf) && ( ((stbuf)->ia_type == IA_IFREG
) && ((stbuf)->ia_prot.sticky == 1) && ((stbuf
)->ia_prot.sgid == 1))) { (stbuf)->ia_prot.sticky = 0; (
stbuf)->ia_prot.sgid = 0; } } while (0)
;
416 DHT_STACK_UNWIND (readv, frame, op_ret, op_errno, vector, count, stbuf,do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readv_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 417, 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, op_ret
, op_errno, vector, count, stbuf, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
417 iobref, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readv_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 417, 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, op_ret
, op_errno, vector, count, stbuf, iobref, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
418
419 return 0;
420}
421
422int
423dht_readv2 (xlator_t *this, call_frame_t *frame, int op_ret)
424{
425 dht_local_t *local = NULL((void*)0);
426 xlator_t *subvol = NULL((void*)0);
427 int op_errno = EINVAL22;
428
429 local = frame->local;
430 if (!local)
431 goto out;
432
433 op_errno = local->op_errno;
434 if (op_ret == -1)
435 goto out;
436
437 local->call_cnt = 2;
438 subvol = local->cached_subvol;
439
440 STACK_WIND (frame, dht_readv_cbk, subvol, subvol->fops->readv,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 442
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readv_cbk) tmp_cbk = dht_readv_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->readv"; _new->unwind_to = "dht_readv_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readv); subvol->fops->readv (_new, subvol, local
->fd, local->rebalance.size, local->rebalance.offset
, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
441 local->fd, local->rebalance.size, local->rebalance.offset,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 442
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readv_cbk) tmp_cbk = dht_readv_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->readv"; _new->unwind_to = "dht_readv_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readv); subvol->fops->readv (_new, subvol, local
->fd, local->rebalance.size, local->rebalance.offset
, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
442 local->rebalance.flags, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 442
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readv_cbk) tmp_cbk = dht_readv_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->readv"; _new->unwind_to = "dht_readv_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readv); subvol->fops->readv (_new, subvol, local
->fd, local->rebalance.size, local->rebalance.offset
, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
443
444 return 0;
445
446out:
447 DHT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readv_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 447, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_readv_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), 0, ((void*)0), ((void*)0), ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0); dht_local_wipe
(__xl, __local); } while (0)
;
448 return 0;
449}
450
451int
452dht_readv (call_frame_t *frame, xlator_t *this,
453 fd_t *fd, size_t size, off_t off, uint32_t flags, dict_t *xdata)
454{
455 xlator_t *subvol = NULL((void*)0);
456 int op_errno = -1;
457 dht_local_t *local = NULL((void*)0);
458
459 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 459, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
460 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 460, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
461 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 461, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
462
463 local = dht_local_init (frame, NULL((void*)0), fd, GF_FOP_READ);
464 if (!local) {
465 op_errno = ENOMEM12;
466 goto err;
467 }
468
469 subvol = local->cached_subvol;
470 if (!subvol) {
471 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 472, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
472 "no cached subvolume for fd=%p", fd)do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 472, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
;
473 op_errno = EINVAL22;
474 goto err;
475 }
476
477 local->rebalance.offset = off;
478 local->rebalance.size = size;
479 local->rebalance.flags = flags;
480 local->call_cnt = 1;
481
482 STACK_WIND (frame, dht_readv_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 484
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readv_cbk) tmp_cbk = dht_readv_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->readv"; _new->unwind_to = "dht_readv_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readv); subvol->fops->readv (_new, subvol, fd,
size, off, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
483 subvol, subvol->fops->readv,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 484
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readv_cbk) tmp_cbk = dht_readv_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->readv"; _new->unwind_to = "dht_readv_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readv); subvol->fops->readv (_new, subvol, fd,
size, off, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
484 fd, size, off, flags, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 484
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readv_cbk) tmp_cbk = dht_readv_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->readv"; _new->unwind_to = "dht_readv_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readv); subvol->fops->readv (_new, subvol, fd,
size, off, flags, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
485
486 return 0;
487
488err:
489 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
490 DHT_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readv_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 490, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_readv_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), 0, ((void*)0), ((void*)0), ((void*)0)
); (*__glusterfs_this_location()) = old_THIS; } while (0); dht_local_wipe
(__xl, __local); } while (0)
;
491
492 return 0;
493}
494
495int
496dht_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
497 int op_ret, int op_errno, dict_t *xdata)
498{
499 int ret = -1;
500 dht_local_t *local = NULL((void*)0);
501 xlator_t *subvol = NULL((void*)0);
502
503 local = frame->local;
504
505 if (local->call_cnt != 1)
506 goto out;
507 if ((op_ret == -1) && (op_errno == ENOTCONN107) &&
508 IA_ISDIR(local->loc.inode->ia_type)(local->loc.inode->ia_type == IA_IFDIR)) {
509
510 subvol = dht_first_up_subvol (this);
511 if (!subvol)
512 goto out;
513
514 STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 515
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->access_cbk) tmp_cbk = dht_access_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->access"; _new->unwind_to = "dht_access_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->access); subvol->fops->access (_new, subvol, &
local->loc, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
515 &local->loc, local->rebalance.flags, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 515
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->access_cbk) tmp_cbk = dht_access_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->access"; _new->unwind_to = "dht_access_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->access); subvol->fops->access (_new, subvol, &
local->loc, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
516 return 0;
517 }
518 if ((op_ret == -1) && (op_errno == ENOENT2)) {
519 /* File would be migrated to other node */
520 local->rebalance.target_op_fn = dht_access2;
521 ret = dht_rebalance_complete_check (frame->this, frame);
522 if (!ret)
523 return 0;
524 }
525
526out:
527 DHT_STACK_UNWIND (access, frame, op_ret, op_errno, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_access_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 527, 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, op_ret
, op_errno, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
528 return 0;
529}
530
531int
532dht_access2 (xlator_t *this, call_frame_t *frame, int op_ret)
533{
534 dht_local_t *local = NULL((void*)0);
535 xlator_t *subvol = NULL((void*)0);
536 int op_errno = EINVAL22;
537
538 local = frame->local;
539 if (!local)
540 goto out;
541
542 op_errno = local->op_errno;
543 if (op_ret == -1)
544 goto out;
545
546 local->call_cnt = 2;
547 subvol = local->cached_subvol;
548
549 STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 550
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->access_cbk) tmp_cbk = dht_access_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->access"; _new->unwind_to = "dht_access_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->access); subvol->fops->access (_new, subvol, &
local->loc, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
550 &local->loc, local->rebalance.flags, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 550
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->access_cbk) tmp_cbk = dht_access_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->access"; _new->unwind_to = "dht_access_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->access); subvol->fops->access (_new, subvol, &
local->loc, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
551
552 return 0;
553
554out:
555 DHT_STACK_UNWIND (access, frame, -1, op_errno, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_access_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 555, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_access_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
556 return 0;
557}
558
559
560int
561dht_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
562 dict_t *xdata)
563{
564 xlator_t *subvol = NULL((void*)0);
565 int op_errno = -1;
566 dht_local_t *local = NULL((void*)0);
567
568 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 568, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
569 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 569, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
570 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 570, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
571 VALIDATE_OR_GOTO (loc->inode, err)do { if (!loc->inode) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->inode"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 571, GF_LOG_WARNING, "invalid argument: "
"loc->inode"); } while (0); goto err; } } while (0)
;
572 VALIDATE_OR_GOTO (loc->path, err)do { if (!loc->path) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->path"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 572, GF_LOG_WARNING, "invalid argument: "
"loc->path"); } while (0); goto err; } } while (0)
;
573
574 local = dht_local_init (frame, loc, NULL((void*)0), GF_FOP_ACCESS);
575 if (!local) {
576 op_errno = ENOMEM12;
577 goto err;
578 }
579
580 local->rebalance.flags = mask;
581 local->call_cnt = 1;
582 subvol = local->cached_subvol;
583 if (!subvol) {
584 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 585, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
585 "no cached subvolume for path=%s", loc->path)do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 585, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
;
586 op_errno = EINVAL22;
587 goto err;
588 }
589
590 STACK_WIND (frame, dht_access_cbk, subvol, subvol->fops->access,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 591
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->access_cbk) tmp_cbk = dht_access_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->access"; _new->unwind_to = "dht_access_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->access); subvol->fops->access (_new, subvol, loc
, mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while
(0)
591 loc, mask, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 591
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->access_cbk) tmp_cbk = dht_access_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->access"; _new->unwind_to = "dht_access_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->access); subvol->fops->access (_new, subvol, loc
, mask, xdata); (*__glusterfs_this_location()) = old_THIS; } while
(0)
;
592
593 return 0;
594
595err:
596 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
597 DHT_STACK_UNWIND (access, frame, -1, op_errno, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_access_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 597, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_access_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
598
599 return 0;
600}
601
602
603int
604dht_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
605 int op_ret, int op_errno, dict_t *xdata)
606{
607 dht_local_t *local = NULL((void*)0);
608 int ret = -1;
609
610 local = frame->local;
611
612 local->op_errno = op_errno;
613
614 if (local->call_cnt != 1)
615 goto out;
616
617 /* If context is set, then send flush() it to the destination */
618 ret = fd_ctx_get (local->fd, this, NULL((void*)0));
619 if (!ret) {
620 dht_flush2 (this, frame, 0);
621 return 0;
622 }
623
624out:
625 DHT_STACK_UNWIND (flush, frame, op_ret, op_errno, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_flush_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 625, 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, op_ret
, op_errno, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
626
627 return 0;
628}
629
630int
631dht_flush2 (xlator_t *this, call_frame_t *frame, int op_ret)
632{
633 dht_local_t *local = NULL((void*)0);
634 xlator_t *subvol = NULL((void*)0);
635 uint64_t tmp_subvol = 0;
636 int ret = -1;
637
638 local = frame->local;
639
640 ret = fd_ctx_get (local->fd, this, &tmp_subvol);
641 if (!ret)
642 subvol = (xlator_t *)(long)tmp_subvol;
643
644 if (!subvol)
645 subvol = local->cached_subvol;
646
647 local->call_cnt = 2; /* This is the second attempt */
648
649 STACK_WIND (frame, dht_flush_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 650
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->flush_cbk) tmp_cbk = dht_flush_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->flush"; _new->unwind_to = "dht_flush_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->flush); subvol->fops->flush (_new, subvol, local
->fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
650 subvol, subvol->fops->flush, local->fd, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 650
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->flush_cbk) tmp_cbk = dht_flush_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->flush"; _new->unwind_to = "dht_flush_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->flush); subvol->fops->flush (_new, subvol, local
->fd, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
651
652 return 0;
653}
654
655
656int
657dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
658{
659 xlator_t *subvol = NULL((void*)0);
660 int op_errno = -1;
661 dht_local_t *local = NULL((void*)0);
662
663 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 663, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
664 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 664, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
665 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 665, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
666
667 local = dht_local_init (frame, NULL((void*)0), fd, GF_FOP_FLUSH);
668 if (!local) {
669 op_errno = ENOMEM12;
670 goto err;
671 }
672
673 subvol = local->cached_subvol;
674 if (!subvol) {
675 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 676, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
676 "no cached subvolume for fd=%p", fd)do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 676, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
;
677 op_errno = EINVAL22;
678 goto err;
679 }
680
681 local->call_cnt = 1;
682
683 STACK_WIND (frame, dht_flush_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 684
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->flush_cbk) tmp_cbk = dht_flush_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->flush"; _new->unwind_to = "dht_flush_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->flush); subvol->fops->flush (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
684 subvol, subvol->fops->flush, fd, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 684
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->flush_cbk) tmp_cbk = dht_flush_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->flush"; _new->unwind_to = "dht_flush_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->flush); subvol->fops->flush (_new, subvol, fd,
xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
;
685
686 return 0;
687
688err:
689 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
690 DHT_STACK_UNWIND (flush, frame, -1, op_errno, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_flush_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 690, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_flush_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
691
692 return 0;
693}
694
695
696int
697dht_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
698 int op_errno, struct iatt *prebuf, struct iatt *postbuf,
699 dict_t *xdata)
700{
701 dht_local_t *local = NULL((void*)0);
702 call_frame_t *prev = NULL((void*)0);
703 int ret = -1;
704
705 local = frame->local;
706 prev = cookie;
707
708 local->op_errno = op_errno;
709 if (op_ret == -1) {
710 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 712, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
711 "subvolume %s returned -1 (%s)",do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 712, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
712 prev->this->name, strerror (op_errno))do { do { if (0) printf ("subvolume %s returned -1 (%s)", prev
->this->name, strerror (op_errno)); } while (0); _gf_log
(this->name, "dht-inode-read.c", __FUNCTION__, 712, GF_LOG_DEBUG
, "subvolume %s returned -1 (%s)", prev->this->name, strerror
(op_errno)); } while (0)
;
713 goto out;
714 }
715
716 if (local->call_cnt != 1) {
717 if (local->stbuf.ia_blocks) {
718 dht_iatt_merge (this, postbuf, &local->stbuf, NULL((void*)0));
719 dht_iatt_merge (this, prebuf, &local->prebuf, NULL((void*)0));
720 }
721 goto out;
722 }
723
724 ret = fd_ctx_get (local->fd, this, NULL((void*)0));
725 if (ret) {
726 local->rebalance.target_op_fn = dht_fsync2;
727
728 /* Check if the rebalance phase1 is true */
729 if (IS_DHT_MIGRATION_PHASE1 (postbuf)( ((postbuf)->ia_type == IA_IFREG) && ((postbuf)->
ia_prot.sticky == 1) && ((postbuf)->ia_prot.sgid ==
1))
) {
730 dht_iatt_merge (this, &local->stbuf, postbuf, NULL((void*)0));
731 dht_iatt_merge (this, &local->prebuf, prebuf, NULL((void*)0));
732
733 ret = dht_rebalance_in_progress_check (this, frame);
734 }
735
736 /* Check if the rebalance phase2 is true */
737 if (IS_DHT_MIGRATION_PHASE2 (postbuf)( ((postbuf)->ia_type == IA_IFREG) && ((st_mode_from_ia
((postbuf)->ia_prot, (postbuf)->ia_type) & ~0170000
) == (01000)))
) {
738 ret = dht_rebalance_complete_check (this, frame);
739 }
740 } else {
741 dht_fsync2 (this, frame, 0);
742 }
743 if (!ret)
744 return 0;
745
746out:
747 DHT_STRIP_PHASE1_FLAGS (postbuf)do { if ((postbuf) && ( ((postbuf)->ia_type == IA_IFREG
) && ((postbuf)->ia_prot.sticky == 1) && (
(postbuf)->ia_prot.sgid == 1))) { (postbuf)->ia_prot.sticky
= 0; (postbuf)->ia_prot.sgid = 0; } } while (0)
;
748 DHT_STRIP_PHASE1_FLAGS (prebuf)do { if ((prebuf) && ( ((prebuf)->ia_type == IA_IFREG
) && ((prebuf)->ia_prot.sticky == 1) && ((
prebuf)->ia_prot.sgid == 1))) { (prebuf)->ia_prot.sticky
= 0; (prebuf)->ia_prot.sgid = 0; } } while (0)
;
749 DHT_STACK_UNWIND (fsync, frame, op_ret, op_errno,do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsync_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 750, 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, op_ret
, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
750 prebuf, postbuf, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsync_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 750, 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, op_ret
, op_errno, prebuf, postbuf, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
751
752 return 0;
753}
754
755int
756dht_fsync2 (xlator_t *this, call_frame_t *frame, int op_ret)
757{
758 dht_local_t *local = NULL((void*)0);
759 xlator_t *subvol = NULL((void*)0);
760 uint64_t tmp_subvol = 0;
761 int ret = -1;
762
763 local = frame->local;
764
765 ret = fd_ctx_get (local->fd, this, &tmp_subvol);
766 if (!ret)
767 subvol = (xlator_t *)(long)tmp_subvol;
768
769 if (!subvol)
770 subvol = local->cached_subvol;
771
772 local->call_cnt = 2; /* This is the second attempt */
773
774 STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 775
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fsync_cbk) tmp_cbk = dht_fsync_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fsync"; _new->unwind_to = "dht_fsync_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fsync); subvol->fops->fsync (_new, subvol, local
->fd, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
775 local->fd, local->rebalance.flags, NULL)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 775
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fsync_cbk) tmp_cbk = dht_fsync_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fsync"; _new->unwind_to = "dht_fsync_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fsync); subvol->fops->fsync (_new, subvol, local
->fd, local->rebalance.flags, ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0)
;
776
777 return 0;
778}
779
780int
781dht_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
782 dict_t *xdata)
783{
784 xlator_t *subvol = NULL((void*)0);
785 int op_errno = -1;
786 dht_local_t *local = NULL((void*)0);
787
788 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 788, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
789 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 789, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
790 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 790, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
791
792 local = dht_local_init (frame, NULL((void*)0), fd, GF_FOP_FSYNC);
793 if (!local) {
794 op_errno = ENOMEM12;
795
796 goto err;
797 }
798
799 local->call_cnt = 1;
800 local->rebalance.flags = datasync;
801
802 subvol = local->cached_subvol;
803
804 STACK_WIND (frame, dht_fsync_cbk, subvol, subvol->fops->fsync,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 805
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fsync_cbk) tmp_cbk = dht_fsync_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fsync"; _new->unwind_to = "dht_fsync_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fsync); subvol->fops->fsync (_new, subvol, fd,
datasync, xdata); (*__glusterfs_this_location()) = old_THIS;
} while (0)
805 fd, datasync, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 805
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fsync_cbk) tmp_cbk = dht_fsync_cbk; _new
->root = frame->root; _new->this = subvol; _new->
ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->fsync"; _new->unwind_to = "dht_fsync_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fsync); subvol->fops->fsync (_new, subvol, fd,
datasync, xdata); (*__glusterfs_this_location()) = old_THIS;
} while (0)
;
806
807 return 0;
808
809err:
810 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
811 DHT_STACK_UNWIND (fsync, frame, -1, op_errno, NULL, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fsync_cbk_t fn
= ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *
old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf (
"!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c",
__FUNCTION__, 811, GF_LOG_CRITICAL, "!frame"); } while (0); break
; } fn = (fop_fsync_cbk_t )frame->ret; _parent = frame->
parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
812
813 return 0;
814}
815
816
817/* TODO: for 'lk()' call, we need some other special error, may be ESTALE to
818 indicate that lock migration happened on the fd, so we can consider it as
819 phase 2 of migration */
820int
821dht_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
822 int op_ret, int op_errno, struct gf_flock *flock, dict_t *xdata)
823{
824 DHT_STACK_UNWIND (lk, frame, op_ret, op_errno, flock, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_lk_cbk_t fn =
((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS
= ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"
); } while (0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__
, 824, 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, op_ret, op_errno, flock, xdata); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
825
826 return 0;
827}
828
829
830int
831dht_lk (call_frame_t *frame, xlator_t *this,
832 fd_t *fd, int cmd, struct gf_flock *flock, dict_t *xdata)
833{
834 xlator_t *subvol = NULL((void*)0);
835 int op_errno = -1;
836
837
838 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 838, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
839 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 839, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
840 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 840, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
841
842 subvol = dht_subvol_get_cached (this, fd->inode);
843 if (!subvol) {
844 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 845, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
845 "no cached subvolume for fd=%p", fd)do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 845, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); } while
(0)
;
846 op_errno = EINVAL22;
847 goto err;
848 }
849
850 /* TODO: for rebalance, we need to preserve the fop arguments */
851 STACK_WIND (frame, dht_lk_cbk, subvol, subvol->fops->lk, fd,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 852
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->lk_cbk) tmp_cbk = dht_lk_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->lk"; _new->unwind_to = "dht_lk_cbk";
pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->lk); subvol->fops->lk (_new, subvol, fd, cmd, flock
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
852 cmd, flock, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 852
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->lk_cbk) tmp_cbk = dht_lk_cbk; _new->
root = frame->root; _new->this = subvol; _new->ret =
(ret_fn_t) tmp_cbk; _new->parent = frame; _new->cookie
= _new; _new->wind_from = __FUNCTION__; _new->wind_to =
"subvol->fops->lk"; _new->unwind_to = "dht_lk_cbk";
pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->lk); subvol->fops->lk (_new, subvol, fd, cmd, flock
, xdata); (*__glusterfs_this_location()) = old_THIS; } while (
0)
;
853
854 return 0;
855
856err:
857 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
858 DHT_STACK_UNWIND (lk, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_lk_cbk_t fn =
((void*)0); call_frame_t *_parent = ((void*)0); xlator_t *old_THIS
= ((void*)0); if (!frame) { do { do { if (0) printf ("!frame"
); } while (0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__
, 858, GF_LOG_CRITICAL, "!frame"); } while (0); break; } fn =
(fop_lk_cbk_t )frame->ret; _parent = frame->parent; pthread_spin_lock
(&frame->root->stack_lock); { _parent->ref_count
--; } pthread_spin_unlock (&frame->root->stack_lock
); old_THIS = (*__glusterfs_this_location()); (*__glusterfs_this_location
()) = _parent->this; frame->complete = _gf_true; frame->
unwind_from = __FUNCTION__; if (frame->this->ctx->measure_latency
) gf_latency_end (frame); fn (_parent, frame->cookie, _parent
->this, -1, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
859
860 return 0;
861}
862
863/* Symlinks are currently not migrated, so no need for any check here */
864int
865dht_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
866 int op_ret, int op_errno, const char *path,
867 struct iatt *stbuf, dict_t *xdata)
868{
869 dht_local_t *local = NULL((void*)0);
870
871 local = frame->local;
872 if (op_ret == -1)
873 goto err;
874
875 if (!local) {
876 op_ret = -1;
877 op_errno = EINVAL22;
878 }
879
880err:
881 DHT_STRIP_PHASE1_FLAGS (stbuf)do { if ((stbuf) && ( ((stbuf)->ia_type == IA_IFREG
) && ((stbuf)->ia_prot.sticky == 1) && ((stbuf
)->ia_prot.sgid == 1))) { (stbuf)->ia_prot.sticky = 0; (
stbuf)->ia_prot.sgid = 0; } } while (0)
;
882 DHT_STACK_UNWIND (readlink, frame, op_ret, op_errno, path, stbuf, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 882, 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, op_ret
, op_errno, path, stbuf, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
883
884 return 0;
885}
886
887
888int
889dht_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
890 dict_t *xdata)
891{
892 xlator_t *subvol = NULL((void*)0);
893 int op_errno = -1;
894 dht_local_t *local = NULL((void*)0);
895
896 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 896, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
897 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 897, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
898 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 898, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
899 VALIDATE_OR_GOTO (loc->inode, err)do { if (!loc->inode) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->inode"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 899, GF_LOG_WARNING, "invalid argument: "
"loc->inode"); } while (0); goto err; } } while (0)
;
900 VALIDATE_OR_GOTO (loc->path, err)do { if (!loc->path) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->path"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 900, GF_LOG_WARNING, "invalid argument: "
"loc->path"); } while (0); goto err; } } while (0)
;
901
902 local = dht_local_init (frame, loc, NULL((void*)0), GF_FOP_READLINK);
903 if (!local) {
904 op_errno = ENOMEM12;
905 goto err;
906 }
907
908 subvol = local->cached_subvol;
909 if (!subvol) {
910 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 911, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
911 "no cached subvolume for path=%s", loc->path)do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 911, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
;
912 op_errno = EINVAL22;
913 goto err;
914 }
915
916 STACK_WIND (frame, dht_readlink_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 918
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readlink_cbk) tmp_cbk = dht_readlink_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->readlink"; _new->unwind_to = "dht_readlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readlink); subvol->fops->readlink (_new, subvol
, loc, size, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
917 subvol, subvol->fops->readlink,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 918
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readlink_cbk) tmp_cbk = dht_readlink_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->readlink"; _new->unwind_to = "dht_readlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readlink); subvol->fops->readlink (_new, subvol
, loc, size, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
918 loc, size, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 918
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->readlink_cbk) tmp_cbk = dht_readlink_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->readlink"; _new->unwind_to = "dht_readlink_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->readlink); subvol->fops->readlink (_new, subvol
, loc, size, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
919
920 return 0;
921
922err:
923 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
924 DHT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_readlink_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 924, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_readlink_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
925
926 return 0;
927}
928
929/* Currently no translators on top of 'distribute' will be using
930 * below fops, hence not implementing 'migration' related checks
931 */
932
933int
934dht_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
935 int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
936{
937 DHT_STACK_UNWIND (xattrop, frame, op_ret, op_errno, dict, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_xattrop_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 937, 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, op_ret
, op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
938 return 0;
939}
940
941
942int
943dht_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
944 gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
945{
946 xlator_t *subvol = NULL((void*)0);
947 int op_errno = -1;
948 dht_local_t *local = NULL((void*)0);
949
950 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 950, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
951 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 951, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
952 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 952, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
953 VALIDATE_OR_GOTO (loc->inode, err)do { if (!loc->inode) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->inode"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 953, GF_LOG_WARNING, "invalid argument: "
"loc->inode"); } while (0); goto err; } } while (0)
;
954 VALIDATE_OR_GOTO (loc->path, err)do { if (!loc->path) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->path"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 954, GF_LOG_WARNING, "invalid argument: "
"loc->path"); } while (0); goto err; } } while (0)
;
955
956 local = dht_local_init (frame, loc, NULL((void*)0), GF_FOP_XATTROP);
957 if (!local) {
958 op_errno = ENOMEM12;
959 goto err;
960 }
961
962 subvol = local->cached_subvol;
963 if (!subvol) {
964 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 965, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
965 "no cached subvolume for path=%s", loc->path)do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 965, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
;
966 op_errno = EINVAL22;
967 goto err;
968 }
969
970 local->call_cnt = 1;
971
972 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 975
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->xattrop_cbk) tmp_cbk = dht_xattrop_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->xattrop"; _new->unwind_to = "dht_xattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->xattrop); subvol->fops->xattrop (_new, subvol,
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
973 dht_xattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 975
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->xattrop_cbk) tmp_cbk = dht_xattrop_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->xattrop"; _new->unwind_to = "dht_xattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->xattrop); subvol->fops->xattrop (_new, subvol,
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
974 subvol, subvol->fops->xattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 975
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->xattrop_cbk) tmp_cbk = dht_xattrop_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->xattrop"; _new->unwind_to = "dht_xattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->xattrop); subvol->fops->xattrop (_new, subvol,
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
975 loc, flags, dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 975
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->xattrop_cbk) tmp_cbk = dht_xattrop_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->xattrop"; _new->unwind_to = "dht_xattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->xattrop); subvol->fops->xattrop (_new, subvol,
loc, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
976
977 return 0;
978
979err:
980 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
981 DHT_STACK_UNWIND (xattrop, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_xattrop_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 981, GF_LOG_CRITICAL, "!frame"); } while (0);
break; } fn = (fop_xattrop_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
982
983 return 0;
984}
985
986
987int
988dht_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
989 int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata)
990{
991 DHT_STACK_UNWIND (fxattrop, frame, op_ret, op_errno, dict, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fxattrop_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 991, 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, op_ret
, op_errno, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
992 return 0;
993}
994
995
996int
997dht_fxattrop (call_frame_t *frame, xlator_t *this,
998 fd_t *fd, gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata)
999{
1000 xlator_t *subvol = NULL((void*)0);
1001 int op_errno = -1;
1002
1003 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1003, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
1004 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1004, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
1005 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1005, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
1006
1007 subvol = dht_subvol_get_cached (this, fd->inode);
1008 if (!subvol) {
1009 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 1010, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); }
while (0)
1010 "no cached subvolume for fd=%p", fd)do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 1010, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); }
while (0)
;
1011 op_errno = EINVAL22;
1012 goto err;
1013 }
1014
1015 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1018
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fxattrop_cbk) tmp_cbk = dht_fxattrop_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fxattrop"; _new->unwind_to = "dht_fxattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fxattrop); subvol->fops->fxattrop (_new, subvol
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1016 dht_fxattrop_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1018
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fxattrop_cbk) tmp_cbk = dht_fxattrop_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fxattrop"; _new->unwind_to = "dht_fxattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fxattrop); subvol->fops->fxattrop (_new, subvol
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1017 subvol, subvol->fops->fxattrop,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1018
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fxattrop_cbk) tmp_cbk = dht_fxattrop_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fxattrop"; _new->unwind_to = "dht_fxattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fxattrop); subvol->fops->fxattrop (_new, subvol
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
1018 fd, flags, dict, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1018
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->fxattrop_cbk) tmp_cbk = dht_fxattrop_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->fxattrop"; _new->unwind_to = "dht_fxattrop_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->fxattrop); subvol->fops->fxattrop (_new, subvol
, fd, flags, dict, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0)
;
1019
1020 return 0;
1021
1022err:
1023 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
1024 DHT_STACK_UNWIND (fxattrop, frame, -1, op_errno, NULL, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_fxattrop_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 1024, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_fxattrop_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0), ((void*)0)); (*__glusterfs_this_location
()) = old_THIS; } while (0); dht_local_wipe (__xl, __local); }
while (0)
;
1025
1026 return 0;
1027}
1028
1029
1030int
1031dht_inodelk_cbk (call_frame_t *frame, void *cookie,
1032 xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *xdata)
1033
1034{
1035 DHT_STACK_UNWIND (inodelk, frame, op_ret, op_errno, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_inodelk_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 1035, 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, op_ret
, op_errno, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
1036 return 0;
1037}
1038
1039
1040int32_t
1041dht_inodelk (call_frame_t *frame, xlator_t *this, const char *volume,
1042 loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
1043{
1044 xlator_t *subvol = NULL((void*)0);
1045 int op_errno = -1;
1046 dht_local_t *local = NULL((void*)0);
1047
1048
1049 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1049, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
1050 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1050, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
1051 VALIDATE_OR_GOTO (loc, err)do { if (!loc) { (*__errno_location ()) = 22; do { do { if (0
) printf ("invalid argument: " "loc"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1051, GF_LOG_WARNING, "invalid argument: " "loc"
); } while (0); goto err; } } while (0)
;
1052 VALIDATE_OR_GOTO (loc->inode, err)do { if (!loc->inode) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->inode"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 1052, GF_LOG_WARNING, "invalid argument: "
"loc->inode"); } while (0); goto err; } } while (0)
;
1053 VALIDATE_OR_GOTO (loc->path, err)do { if (!loc->path) { (*__errno_location ()) = 22; do { do
{ if (0) printf ("invalid argument: " "loc->path"); } while
(0); _gf_log_callingfn ((this ? (this->name) : "(Govinda! Govinda!)"
), "dht-inode-read.c", __FUNCTION__, 1053, GF_LOG_WARNING, "invalid argument: "
"loc->path"); } while (0); goto err; } } while (0)
;
1054
1055 local = dht_local_init (frame, loc, NULL((void*)0), GF_FOP_INODELK);
1056 if (!local) {
1057 op_errno = ENOMEM12;
1058 goto err;
1059 }
1060
1061 subvol = local->cached_subvol;
1062 if (!subvol) {
1063 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 1064, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
1064 "no cached subvolume for path=%s", loc->path)do { do { if (0) printf ("no cached subvolume for path=%s", loc
->path); } while (0); _gf_log (this->name, "dht-inode-read.c"
, __FUNCTION__, 1064, GF_LOG_DEBUG, "no cached subvolume for path=%s"
, loc->path); } while (0)
;
1065 op_errno = EINVAL22;
1066 goto err;
1067 }
1068
1069 local->call_cnt = 1;
1070
1071 STACK_WIND (frame,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->inodelk_cbk) tmp_cbk = dht_inodelk_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->inodelk"; _new->unwind_to = "dht_inodelk_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->inodelk); subvol->fops->inodelk (_new, subvol,
volume, loc, cmd, lock, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1072 dht_inodelk_cbk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->inodelk_cbk) tmp_cbk = dht_inodelk_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->inodelk"; _new->unwind_to = "dht_inodelk_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->inodelk); subvol->fops->inodelk (_new, subvol,
volume, loc, cmd, lock, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1073 subvol, subvol->fops->inodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->inodelk_cbk) tmp_cbk = dht_inodelk_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->inodelk"; _new->unwind_to = "dht_inodelk_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->inodelk); subvol->fops->inodelk (_new, subvol,
volume, loc, cmd, lock, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1074 volume, loc, cmd, lock, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1074
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->inodelk_cbk) tmp_cbk = dht_inodelk_cbk;
_new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->inodelk"; _new->unwind_to = "dht_inodelk_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->inodelk); subvol->fops->inodelk (_new, subvol,
volume, loc, cmd, lock, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
;
1075
1076 return 0;
1077
1078err:
1079 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
1080 DHT_STACK_UNWIND (inodelk, frame, -1, op_errno, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_inodelk_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 1080, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_inodelk_cbk_t )frame->ret; _parent = frame
->parent; pthread_spin_lock (&frame->root->stack_lock
); { _parent->ref_count--; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
1081
1082 return 0;
1083}
1084
1085
1086int
1087dht_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
1088 int32_t op_ret, int32_t op_errno, dict_t *xdata)
1089
1090{
1091 DHT_STACK_UNWIND (finodelk, frame, op_ret, op_errno, xdata)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_finodelk_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 1091, 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, op_ret
, op_errno, xdata); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
1092 return 0;
1093}
1094
1095
1096int
1097dht_finodelk (call_frame_t *frame, xlator_t *this, const char *volume,
1098 fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata)
1099{
1100 xlator_t *subvol = NULL((void*)0);
1101 int op_errno = -1;
1102
1103 VALIDATE_OR_GOTO (frame, err)do { if (!frame) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "frame"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1103, GF_LOG_WARNING, "invalid argument: " "frame"
); } while (0); goto err; } } while (0)
;
1104 VALIDATE_OR_GOTO (this, err)do { if (!this) { (*__errno_location ()) = 22; do { do { if (
0) printf ("invalid argument: " "this"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1104, GF_LOG_WARNING, "invalid argument: " "this"
); } while (0); goto err; } } while (0)
;
1105 VALIDATE_OR_GOTO (fd, err)do { if (!fd) { (*__errno_location ()) = 22; do { do { if (0)
printf ("invalid argument: " "fd"); } while (0); _gf_log_callingfn
((this ? (this->name) : "(Govinda! Govinda!)"), "dht-inode-read.c"
, __FUNCTION__, 1105, GF_LOG_WARNING, "invalid argument: " "fd"
); } while (0); goto err; } } while (0)
;
1106
1107 subvol = dht_subvol_get_cached (this, fd->inode);
1108 if (!subvol) {
1109 gf_log (this->name, GF_LOG_DEBUG,do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 1110, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); }
while (0)
1110 "no cached subvolume for fd=%p", fd)do { do { if (0) printf ("no cached subvolume for fd=%p", fd)
; } while (0); _gf_log (this->name, "dht-inode-read.c", __FUNCTION__
, 1110, GF_LOG_DEBUG, "no cached subvolume for fd=%p", fd); }
while (0)
;
1111 op_errno = EINVAL22;
1112 goto err;
1113 }
1114
1115
1116 STACK_WIND (frame, dht_finodelk_cbk, subvol, subvol->fops->finodelk,do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1117
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->finodelk_cbk) tmp_cbk = dht_finodelk_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->finodelk"; _new->unwind_to = "dht_finodelk_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->finodelk); subvol->fops->finodelk (_new, subvol
, volume, fd, cmd, lock, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
1117 volume, fd, cmd, lock, xdata)do { call_frame_t *_new = ((void*)0); xlator_t *old_THIS = ((
void*)0); _new = mem_get0 (frame->root->pool->frame_mem_pool
); if (!_new) { do { do { if (0) printf ("alloc failed"); } while
(0); _gf_log ("stack", "dht-inode-read.c", __FUNCTION__, 1117
, GF_LOG_ERROR, "alloc failed"); } while (0); break; } typeof
( subvol->fops->finodelk_cbk) tmp_cbk = dht_finodelk_cbk
; _new->root = frame->root; _new->this = subvol; _new
->ret = (ret_fn_t) tmp_cbk; _new->parent = frame; _new->
cookie = _new; _new->wind_from = __FUNCTION__; _new->wind_to
= "subvol->fops->finodelk"; _new->unwind_to = "dht_finodelk_cbk"
; pthread_spin_init (&_new->lock, 0); pthread_spin_lock
(&frame->root->stack_lock); { _new->next = frame
->root->frames.next; _new->prev = &frame->root
->frames; if (frame->root->frames.next) frame->root
->frames.next->prev = _new; frame->root->frames.next
= _new; frame->ref_count++; } pthread_spin_unlock (&frame
->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = subvol; if (frame->this
->ctx->measure_latency) gf_latency_begin (_new, subvol->
fops->finodelk); subvol->fops->finodelk (_new, subvol
, volume, fd, cmd, lock, xdata); (*__glusterfs_this_location(
)) = old_THIS; } while (0)
;
1118
1119 return 0;
1120
1121err:
1122 op_errno = (op_errno == -1) ? errno(*__errno_location ()) : op_errno;
1123 DHT_STACK_UNWIND (finodelk, frame, -1, op_errno, NULL)do { dht_local_t *__local = ((void*)0); xlator_t *__xl = ((void
*)0); if (frame) { __xl = frame->this; __local = frame->
local; frame->local = ((void*)0); } do { fop_finodelk_cbk_t
fn = ((void*)0); call_frame_t *_parent = ((void*)0); xlator_t
*old_THIS = ((void*)0); if (!frame) { do { do { if (0) printf
("!frame"); } while (0); _gf_log ("stack", "dht-inode-read.c"
, __FUNCTION__, 1123, GF_LOG_CRITICAL, "!frame"); } while (0)
; break; } fn = (fop_finodelk_cbk_t )frame->ret; _parent =
frame->parent; pthread_spin_lock (&frame->root->
stack_lock); { _parent->ref_count--; } pthread_spin_unlock
(&frame->root->stack_lock); old_THIS = (*__glusterfs_this_location
()); (*__glusterfs_this_location()) = _parent->this; frame
->complete = _gf_true; frame->unwind_from = __FUNCTION__
; if (frame->this->ctx->measure_latency) gf_latency_end
(frame); fn (_parent, frame->cookie, _parent->this, -1
, op_errno, ((void*)0)); (*__glusterfs_this_location()) = old_THIS
; } while (0); dht_local_wipe (__xl, __local); } while (0)
;
1124
1125 return 0;
1126}