summaryrefslogtreecommitdiffstats
path: root/xlators/lib/src/libxlator.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/lib/src/libxlator.c')
-rw-r--r--xlators/lib/src/libxlator.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/xlators/lib/src/libxlator.c b/xlators/lib/src/libxlator.c
index 3a8ab121af9..a6213525923 100644
--- a/xlators/lib/src/libxlator.c
+++ b/xlators/lib/src/libxlator.c
@@ -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;
}
@@ -178,14 +180,13 @@ 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;
- }
-
- STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
+ } else if (need_unwind)
+ STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict);
return 0;
}
@@ -199,9 +200,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;
}
@@ -209,20 +212,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)) {
@@ -233,11 +239,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))) {
@@ -249,8 +257,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:
@@ -265,8 +274,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;
}
@@ -278,14 +288,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;
}