xlator/lib: Drain out sent requests to avoid multiple STACK_UNWINDs
Change-Id: If28e4b6e157ac0cb9e1f325bbba39f6c3f1c2b45 BUG: 789078 Reviewed-on: http://review.gluster.com/2881 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
This commit is contained in:
parent
228d01916c
commit
293aa0b9a0
@ -92,12 +92,14 @@ cluster_markerxtime_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (!this || !frame || !frame->local || !cookie) {
|
||||
gf_log ("", GF_LOG_DEBUG, "possible NULL deref");
|
||||
need_unwind = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
local = frame->local;
|
||||
if (!local || !local->vol_uuid) {
|
||||
gf_log (this->name, GF_LOG_DEBUG, "possible NULL deref");
|
||||
need_unwind = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -181,15 +183,15 @@ unlock:
|
||||
}
|
||||
|
||||
out:
|
||||
if (need_unwind && local->xl_specf_unwind) {
|
||||
if (need_unwind && local && local->xl_specf_unwind) {
|
||||
frame->local = local->xl_local;
|
||||
local->xl_specf_unwind (frame, op_ret,
|
||||
op_errno, dict);
|
||||
return 0;
|
||||
} else {
|
||||
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
|
||||
}
|
||||
|
||||
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
@ -203,9 +205,11 @@ cluster_markeruuid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
xl_marker_local_t *local = NULL;
|
||||
int32_t ret = -1;
|
||||
char need_unwind = 0;
|
||||
char *vol_uuid = NULL;
|
||||
|
||||
if (!this || !frame || !cookie) {
|
||||
gf_log ("", GF_LOG_DEBUG, "possible NULL deref");
|
||||
need_unwind = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -213,20 +217,23 @@ cluster_markeruuid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
|
||||
if (!local) {
|
||||
gf_log (this->name, GF_LOG_DEBUG, "possible NULL deref");
|
||||
need_unwind = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
LOCK (&frame->lock);
|
||||
{
|
||||
callcnt = --local->call_count;
|
||||
vol_uuid = local->vol_uuid;
|
||||
|
||||
if (op_ret) {
|
||||
marker_local_incr_errcount (local, op_errno);
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
ret = dict_get_ptr (dict, GF_XATTR_MARKER_KEY,
|
||||
ret = dict_get_bin (dict, GF_XATTR_MARKER_KEY,
|
||||
(void *)&volmark);
|
||||
if (!ret)
|
||||
if (ret)
|
||||
goto unlock;
|
||||
|
||||
if (marker_has_volinfo (local)) {
|
||||
@ -237,11 +244,13 @@ cluster_markeruuid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
if (volmark->retval) {
|
||||
if (local->retval)
|
||||
goto unlock;
|
||||
else if (volmark->retval) {
|
||||
GF_FREE (local->volmark);
|
||||
local->volmark =
|
||||
memdup (volmark, sizeof (*volmark));
|
||||
callcnt = 0;
|
||||
local->retval = volmark->retval;
|
||||
} else if ((volmark->sec > local->volmark->sec) ||
|
||||
((volmark->sec == local->volmark->sec) &&
|
||||
(volmark->usec >= local->volmark->usec))) {
|
||||
@ -253,8 +262,9 @@ cluster_markeruuid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
||||
} else {
|
||||
local->volmark = memdup (volmark, sizeof (*volmark));
|
||||
VALIDATE_OR_GOTO (local->volmark, unlock);
|
||||
uuid_unparse (volmark->uuid, vol_uuid);
|
||||
if (volmark->retval)
|
||||
callcnt = 0;
|
||||
local->retval = volmark->retval;
|
||||
}
|
||||
}
|
||||
unlock:
|
||||
@ -269,8 +279,9 @@ unlock:
|
||||
if (!dict)
|
||||
dict = dict_new();
|
||||
|
||||
if (dict_set_ptr (dict, GF_XATTR_MARKER_KEY,
|
||||
local->volmark)) {
|
||||
if (dict_set_bin (dict, GF_XATTR_MARKER_KEY,
|
||||
local->volmark,
|
||||
sizeof (struct volume_mark))) {
|
||||
op_ret = -1;
|
||||
op_errno = ENOMEM;
|
||||
}
|
||||
@ -282,14 +293,14 @@ unlock:
|
||||
}
|
||||
|
||||
out:
|
||||
if (need_unwind && local->xl_specf_unwind) {
|
||||
if (need_unwind && local && local->xl_specf_unwind) {
|
||||
frame->local = local->xl_local;
|
||||
local->xl_specf_unwind (frame, op_ret,
|
||||
op_errno, dict);
|
||||
return 0;
|
||||
} else if (need_unwind){
|
||||
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
|
||||
}
|
||||
|
||||
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ struct marker_str {
|
||||
xlator_specf_unwind_t xl_specf_unwind;
|
||||
void *xl_local;
|
||||
char *vol_uuid;
|
||||
uint8_t retval;
|
||||
};
|
||||
|
||||
typedef struct marker_str xl_marker_local_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user