struct C_OpenPGs : public Context {
set<PGRef> pgs;
ObjectStore *store;
- C_OpenPGs(set<PGRef>& p, ObjectStore *s) : store(s) {
+ OSD *osd;
+ C_OpenPGs(set<PGRef>& p, ObjectStore *s, OSD* o) : store(s), osd(o) {
pgs.swap(p);
}
void finish(int r) {
+ RWLock::RLocker l(osd->pg_map_lock);
for (auto p : pgs) {
- p->ch = store->open_collection(p->coll);
- assert(p->ch);
+ if (osd->pg_map.count(p->info.pgid)) {
+ p->ch = store->open_collection(p->coll);
+ assert(p->ch);
+ }
}
}
};
{
if (!ctx.transaction->empty()) {
if (!ctx.created_pgs.empty()) {
- ctx.on_applied->add(new C_OpenPGs(ctx.created_pgs, store));
+ ctx.on_applied->add(new C_OpenPGs(ctx.created_pgs, store, this));
}
int tr = store->queue_transaction(
pg->osr.get(),
assert(ctx.created_pgs.empty());
} else {
if (!ctx.created_pgs.empty()) {
- ctx.on_applied->add(new C_OpenPGs(ctx.created_pgs, store));
+ ctx.on_applied->add(new C_OpenPGs(ctx.created_pgs, store, this));
}
int tr = store->queue_transaction(
pg->osr.get(),
class HistoricOpsSocketHook;
class TestOpsSocketHook;
struct C_CompleteSplits;
+struct C_OpenPGs;
class LogChannel;
class CephContext;
typedef ceph::shared_ptr<ObjectStore::Sequencer> SequencerRef;
friend class TestOpsSocketHook;
TestOpsSocketHook *test_ops_hook;
friend struct C_CompleteSplits;
+ friend struct C_OpenPGs;
// -- op queue --
enum io_queue {