diff options
| -rw-r--r-- | xlators/lib/src/libxlator.c | 37 | ||||
| -rw-r--r-- | xlators/lib/src/libxlator.h | 1 | 
2 files changed, 25 insertions, 13 deletions
diff --git a/xlators/lib/src/libxlator.c b/xlators/lib/src/libxlator.c index 60298e52528..68e028267e1 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;          } @@ -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;  } diff --git a/xlators/lib/src/libxlator.h b/xlators/lib/src/libxlator.h index 75a36379848..1bc20ac6b92 100644 --- a/xlators/lib/src/libxlator.h +++ b/xlators/lib/src/libxlator.h @@ -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;  | 
