Merge pull request #10301 from cbodley/wip-rgw-meta-stack-wakeup

rgw: RGWMetaSyncCR holds refs to stacks instead of crs

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
Reviewed-by: Matt Benjamin <mbenjami@redhat.com>
This commit is contained in:
Yehuda Sadeh 2016-07-15 19:19:57 -07:00 committed by GitHub
commit 3e5775475b

View File

@ -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,
@ -1727,8 +1732,8 @@ public:
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
@ -1764,7 +1769,7 @@ public:
if (iter == shard_crs.end()) {
return;
}
iter->second->wakeup();
iter->second.first->wakeup();
}
};