mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
osd: fix dirty_info check for advance/activate paths
Previously we would check and write dirty_info *without the pg lock* after doing the advance and activate map calls. This was unlikely to race with anything because the queues were drained, but definitely not right. Instead, do the write in activate_map, or explicitly if activate_map is not called (so that we record our progress after handling maps when we are not up). Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
parent
254644a4f0
commit
0c860c17ba
@ -3284,6 +3284,17 @@ void OSD::handle_osd_map(MOSDMap *m)
|
||||
|
||||
// yay!
|
||||
activate_map(t, fin->contexts);
|
||||
} else {
|
||||
// write updated pg state to store
|
||||
for (hash_map<pg_t,PG*>::iterator i = pg_map.begin();
|
||||
i != pg_map.end();
|
||||
i++) {
|
||||
PG *pg = i->second;
|
||||
pg->lock_with_map_lock_held();
|
||||
if (pg->dirty_info)
|
||||
pg->write_info(t);
|
||||
pg->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
bool do_shutdown = false;
|
||||
@ -3338,15 +3349,6 @@ void OSD::handle_osd_map(MOSDMap *m)
|
||||
// process waiters
|
||||
take_waiters(waiting_for_osdmap);
|
||||
|
||||
// write updated pg state to store
|
||||
for (hash_map<pg_t,PG*>::iterator i = pg_map.begin();
|
||||
i != pg_map.end();
|
||||
i++) {
|
||||
PG *pg = i->second;
|
||||
if (pg->dirty_info)
|
||||
pg->write_info(t);
|
||||
}
|
||||
|
||||
// note in the superblock that we were clean thru the prior epoch
|
||||
if (boot_epoch && boot_epoch >= superblock.mounted) {
|
||||
superblock.mounted = boot_epoch;
|
||||
@ -3606,6 +3608,9 @@ void OSD::activate_map(ObjectStore::Transaction& t, list<Context*>& tfin)
|
||||
|
||||
PG::RecoveryCtx rctx(&query_map, &info_map, ¬ify_list, &tfin, &t);
|
||||
pg->handle_activate_map(&rctx);
|
||||
|
||||
if (pg->dirty_info)
|
||||
pg->write_info(t);
|
||||
|
||||
pg->unlock();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user