Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: fix lockdep false positive #8284

Merged
merged 3 commits into from Mar 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: cant we use auto here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@theanalyst yes we can, but this is just indentation fix (and removed extra line), so I wouldn't go into changing it just now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, no issues

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oritwas this line shouldn't have been there.. there's no switch statement, it only compiles because the reenter/yield expand into a switch statement. The if there replaced the original switch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this used to be a switch statement that changed to an if on the line above. i assume the compiler didn't complain about the leftover case here because the boost reenter macro is using a switch under the covers

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