Skip to content

Commit

Permalink
Merge pull request #8284 from yehudasa/wip-rgw-sync-fixes-5
Browse files Browse the repository at this point in the history
rgw: fix lockdep false positive
  • Loading branch information
cbodley committed Mar 28, 2016
2 parents b83f339 + c3fcd83 commit 516ad93
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
21 changes: 10 additions & 11 deletions src/rgw/rgw_data_sync.cc
Expand Up @@ -1239,17 +1239,16 @@ class RGWDataSyncCR : public RGWCoroutine {

yield {
if ((rgw_data_sync_info::SyncState)sync_status.sync_info.state == rgw_data_sync_info::StateSync) {
case rgw_data_sync_info::StateSync:
for (map<uint32_t, rgw_data_sync_marker>::iterator iter = sync_status.sync_markers.begin();
iter != sync_status.sync_markers.end(); ++iter) {
RGWDataSyncShardControlCR *cr = new RGWDataSyncShardControlCR(sync_env, sync_env->store->get_zone_params().log_pool,
iter->first, iter->second);
cr->get();
shard_crs_lock.Lock();
shard_crs[iter->first] = cr;
shard_crs_lock.Unlock();
spawn(cr, true);
}
for (map<uint32_t, rgw_data_sync_marker>::iterator iter = sync_status.sync_markers.begin();
iter != sync_status.sync_markers.end(); ++iter) {
RGWDataSyncShardControlCR *cr = new RGWDataSyncShardControlCR(sync_env, sync_env->store->get_zone_params().log_pool,
iter->first, iter->second);
cr->get();
shard_crs_lock.Lock();
shard_crs[iter->first] = cr;
shard_crs_lock.Unlock();
spawn(cr, true);
}
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/rgw/rgw_rados.cc
Expand Up @@ -6571,11 +6571,15 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,

return 0;
set_err_state:
if (copy_if_newer && ret == -ERR_NOT_MODIFIED) {
ret = 0;
}
if (opstate) {
RGWOpState::OpState state = RGWOpState::OPSTATE_ERROR;
if (copy_if_newer && ret == -ERR_NOT_MODIFIED) {
RGWOpState::OpState state;
if (ret < 0) {
state = RGWOpState::OPSTATE_ERROR;
} else {
state = RGWOpState::OPSTATE_COMPLETE;
ret = 0;
}
int r = opstate->set_state(state);
if (r < 0) {
Expand Down
12 changes: 8 additions & 4 deletions src/rgw/rgw_rest_client.cc
Expand Up @@ -672,12 +672,16 @@ int RGWRESTStreamRWRequest::get_resource(RGWAccessKey& key, map<string, string>&
int RGWRESTStreamRWRequest::complete(string& etag, real_time *mtime, map<string, string>& attrs)
{
set_str_from_headers(out_headers, "ETAG", etag);
if (mtime) {
if (status > 0 && mtime) {
string mtime_str;
set_str_from_headers(out_headers, "RGWX_MTIME", mtime_str);
int ret = parse_rgwx_mtime(cct, mtime_str, mtime);
if (ret < 0) {
return ret;
if (!mtime_str.empty()) {
int ret = parse_rgwx_mtime(cct, mtime_str, mtime);
if (ret < 0) {
return ret;
}
} else {
*mtime = real_time();
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/rgw/rgw_sync.h
Expand Up @@ -5,6 +5,7 @@
#include "rgw_http_client.h"
#include "rgw_meta_sync_status.h"

#include "include/stringify.h"
#include "common/RWLock.h"

#define ERROR_LOGGER_SHARDS 32
Expand Down Expand Up @@ -142,7 +143,7 @@ class RGWBackoffControlCR : public RGWCoroutine
}

public:
RGWBackoffControlCR(CephContext *_cct, bool _exit_on_error) : RGWCoroutine(_cct), cr(NULL), lock("RGWBackoffControlCR::lock"),
RGWBackoffControlCR(CephContext *_cct, bool _exit_on_error) : RGWCoroutine(_cct), cr(NULL), lock("RGWBackoffControlCR::lock:" + stringify(this)),
reset_backoff(false), exit_on_error(_exit_on_error) {
}

Expand Down

0 comments on commit 516ad93

Please sign in to comment.