mirror of
https://github.com/ceph/ceph
synced 2025-01-19 09:32:00 +00:00
PG: grab reference to pg in C_OSD_AppliedRecoveredObject
Otherwise, accessing the pg via _applied_recovered_object isn't safe. Using intrusive_ptr clarifies the reference ownership. Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
parent
d4410e4ad5
commit
3821f6c4bf
@ -5713,3 +5713,6 @@ bool PG::PriorSet::affected_by_map(const OSDMapRef osdmap, const PG *debug_pg) c
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void boost::intrusive_ptr_add_ref(PG *pg) { pg->get(); }
|
||||||
|
void boost::intrusive_ptr_release(PG *pg) { pg->put(); }
|
||||||
|
@ -1564,4 +1564,9 @@ WRITE_CLASS_ENCODER(PG::OndiskLog)
|
|||||||
|
|
||||||
ostream& operator<<(ostream& out, const PG& pg);
|
ostream& operator<<(ostream& out, const PG& pg);
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
void intrusive_ptr_add_ref(PG *pg);
|
||||||
|
void intrusive_ptr_release(PG *pg);
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -849,7 +849,7 @@ protected:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct C_OSD_AppliedRecoveredObject : public Context {
|
struct C_OSD_AppliedRecoveredObject : public Context {
|
||||||
ReplicatedPG *pg;
|
boost::intrusive_ptr<ReplicatedPG> pg;
|
||||||
ObjectStore::Transaction *t;
|
ObjectStore::Transaction *t;
|
||||||
ObjectContext *obc;
|
ObjectContext *obc;
|
||||||
C_OSD_AppliedRecoveredObject(ReplicatedPG *p, ObjectStore::Transaction *tt, ObjectContext *o) :
|
C_OSD_AppliedRecoveredObject(ReplicatedPG *p, ObjectStore::Transaction *tt, ObjectContext *o) :
|
||||||
|
Loading…
Reference in New Issue
Block a user