From e09c90fd4be3cd5f9becbc32f97f532f07c8ba58 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 11 Feb 2012 09:28:14 -0800 Subject: [PATCH] osd: queue pg removal under pg's epoch The PG may be doing work relative to a different epoch than what the osd has. Make sure the PG removal message is queued under that epoch to avoid confusing/crashing the recipient like so: 2012-02-10 23:26:35.691793 7f387281f700 osd.3 514 queue_pg_for_deletion: 0.0 osd/OSD.cc: In function 'void OSD::handle_pg_remove(OpRequest*)' thread 7f387281f700 time 2012-02-10 23:26:35.691820 osd/OSD.cc: 4860: FAILED assert(pg->get_primary() == m->get_source().num()) Signed-off-by: Sage Weil --- src/osd/OSD.h | 4 ++-- src/osd/PG.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 9e0930e00c57a..7656bc69ca979 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -746,9 +746,9 @@ protected: Mutex remove_list_lock; map > > remove_list; - void queue_for_removal(int osd, pg_t pgid) { + void queue_for_removal(epoch_t epoch, int osd, pg_t pgid) { remove_list_lock.Lock(); - remove_list[osdmap->get_epoch()][osd].push_back(pgid); + remove_list[epoch][osd].push_back(pgid); remove_list_lock.Unlock(); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 5907dd1969aa2..26c4a7cfee575 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1607,7 +1607,7 @@ void PG::purge_strays() p++) { if (get_osdmap()->is_up(*p)) { dout(10) << "sending PGRemove to osd." << *p << dendl; - osd->queue_for_removal(*p, info.pgid); + osd->queue_for_removal(get_osdmap()->get_epoch(), *p, info.pgid); stray_purged.insert(*p); } else { dout(10) << "not sending PGRemove to down osd." << *p << dendl; -- 2.39.5