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: RGWMetaSyncCR holds refs to stacks instead of crs #10301

Merged
merged 1 commit into from Jul 16, 2016
Merged
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
13 changes: 9 additions & 4 deletions src/rgw/rgw_sync.cc
Expand Up @@ -1668,8 +1668,13 @@ class RGWMetaSyncCR : public RGWCoroutine {

std::mutex mutex; //< protect access to shard_crs

// TODO: it should be enough to hold a reference on the stack only, as calling
// RGWCoroutinesStack::wakeup() doesn't refer to the RGWCoroutine if it has
// already completed
using ControlCRRef = boost::intrusive_ptr<RGWMetaSyncShardControlCR>;
map<int, ControlCRRef> shard_crs;
using StackRef = boost::intrusive_ptr<RGWCoroutinesStack>;
using RefPair = std::pair<ControlCRRef, StackRef>;
map<int, RefPair> shard_crs;

public:
RGWMetaSyncCR(RGWMetaSyncEnv *_sync_env, RGWPeriodHistory::Cursor cursor,
Expand Down Expand Up @@ -1727,8 +1732,8 @@ class RGWMetaSyncCR : public RGWCoroutine {
auto cr = new RGWMetaSyncShardControlCR(sync_env, pool, period_id,
mdlog, shard_id, marker,
std::move(period_marker));
shard_crs[shard_id] = cr;
spawn(cr, false);
auto stack = spawn(cr, false);
shard_crs[shard_id] = RefPair{cr, stack};
}
}
// wait for each shard to complete
Expand Down Expand Up @@ -1764,7 +1769,7 @@ class RGWMetaSyncCR : public RGWCoroutine {
if (iter == shard_crs.end()) {
return;
}
iter->second->wakeup();
iter->second.first->wakeup();
}
};

Expand Down