mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
Merge pull request #2621 from ceph/wip-objecter-shutdown
Fix Objecter shutdown races with message handling Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
2f2f8c48a9
@ -706,9 +706,9 @@ void Objecter::_scan_requests(OSDSession *s,
|
||||
|
||||
void Objecter::handle_osd_map(MOSDMap *m)
|
||||
{
|
||||
assert(initialized.read());
|
||||
|
||||
RWLock::WLocker wl(rwlock);
|
||||
if (!initialized.read())
|
||||
return;
|
||||
|
||||
assert(osdmap);
|
||||
|
||||
@ -1537,7 +1537,8 @@ void Objecter::tick()
|
||||
assert(rwlock.is_locked());
|
||||
|
||||
ldout(cct, 10) << "tick" << dendl;
|
||||
assert(initialized.read());
|
||||
if (!initialized.read())
|
||||
return;
|
||||
|
||||
// we are only called by C_Tick
|
||||
assert(tick_event);
|
||||
@ -2452,7 +2453,6 @@ void Objecter::unregister_op(Op *op)
|
||||
/* This function DOES put the passed message before returning */
|
||||
void Objecter::handle_osd_op_reply(MOSDOpReply *m)
|
||||
{
|
||||
assert(initialized.read());
|
||||
ldout(cct, 10) << "in handle_osd_op_reply" << dendl;
|
||||
|
||||
// get pio
|
||||
@ -2461,6 +2461,11 @@ void Objecter::handle_osd_op_reply(MOSDOpReply *m)
|
||||
int osd_num = (int)m->get_source().num();
|
||||
|
||||
RWLock::RLocker l(rwlock);
|
||||
if (!initialized.read()) {
|
||||
m->put();
|
||||
return;
|
||||
}
|
||||
|
||||
RWLock::Context lc(rwlock, RWLock::Context::TakenForRead);
|
||||
|
||||
map<int, OSDSession *>::iterator siter = osd_sessions.find(osd_num);
|
||||
@ -3022,9 +3027,12 @@ void Objecter::_pool_op_submit(PoolOp *op)
|
||||
*/
|
||||
void Objecter::handle_pool_op_reply(MPoolOpReply *m)
|
||||
{
|
||||
assert(initialized.read());
|
||||
|
||||
rwlock.get_read();
|
||||
if (!initialized.read()) {
|
||||
rwlock.put_read();
|
||||
m->put();
|
||||
return;
|
||||
}
|
||||
|
||||
ldout(cct, 10) << "handle_pool_op_reply " << *m << dendl;
|
||||
ceph_tid_t tid = m->get_tid();
|
||||
@ -3151,11 +3159,15 @@ void Objecter::_poolstat_submit(PoolStatOp *op)
|
||||
|
||||
void Objecter::handle_get_pool_stats_reply(MGetPoolStatsReply *m)
|
||||
{
|
||||
assert(initialized.read());
|
||||
ldout(cct, 10) << "handle_get_pool_stats_reply " << *m << dendl;
|
||||
ceph_tid_t tid = m->get_tid();
|
||||
|
||||
RWLock::WLocker wl(rwlock);
|
||||
if (!initialized.read()) {
|
||||
m->put();
|
||||
return;
|
||||
}
|
||||
|
||||
map<ceph_tid_t, PoolStatOp *>::iterator iter = poolstat_ops.find(tid);
|
||||
if (iter != poolstat_ops.end()) {
|
||||
PoolStatOp *op = poolstat_ops[tid];
|
||||
@ -3254,9 +3266,11 @@ void Objecter::_fs_stats_submit(StatfsOp *op)
|
||||
|
||||
void Objecter::handle_fs_stats_reply(MStatfsReply *m)
|
||||
{
|
||||
assert(initialized.read());
|
||||
|
||||
RWLock::WLocker wl(rwlock);
|
||||
if (!initialized.read()) {
|
||||
m->put();
|
||||
return;
|
||||
}
|
||||
|
||||
ldout(cct, 10) << "handle_fs_stats_reply " << *m << dendl;
|
||||
ceph_tid_t tid = m->get_tid();
|
||||
@ -3364,6 +3378,10 @@ bool Objecter::ms_handle_reset(Connection *con)
|
||||
if (osd >= 0) {
|
||||
ldout(cct, 1) << "ms_handle_reset on osd." << osd << dendl;
|
||||
rwlock.get_write();
|
||||
if (!initialized.read()) {
|
||||
rwlock.put_write();
|
||||
return false;
|
||||
}
|
||||
map<int,OSDSession*>::iterator p = osd_sessions.find(osd);
|
||||
if (p != osd_sessions.end()) {
|
||||
OSDSession *session = p->second;
|
||||
@ -3675,6 +3693,10 @@ void Objecter::handle_command_reply(MCommandReply *m)
|
||||
int osd_num = (int)m->get_source().num();
|
||||
|
||||
RWLock::WLocker wl(rwlock);
|
||||
if (!initialized.read()) {
|
||||
m->put();
|
||||
return;
|
||||
}
|
||||
|
||||
map<int, OSDSession *>::iterator siter = osd_sessions.find(osd_num);
|
||||
if (siter == osd_sessions.end()) {
|
||||
|
@ -1594,7 +1594,7 @@ public:
|
||||
messenger(m), monc(mc),
|
||||
osdmap(new OSDMap),
|
||||
cct(cct_),
|
||||
initialized(false),
|
||||
initialized(0),
|
||||
last_tid(0), client_inc(-1), max_linger_id(0),
|
||||
num_unacked(0), num_uncommitted(0),
|
||||
global_op_flags(0),
|
||||
|
Loading…
Reference in New Issue
Block a user