From aa8f2f138cc633292376dd1f449c7ebfc8a37910 Mon Sep 17 00:00:00 2001 From: Haomai Wang Date: Mon, 12 Sep 2016 18:09:00 +0800 Subject: [PATCH] OSD: avoid FileStore finisher deadlock in osd_lock when shutdown OSD When OSD receive signal to shutdown, it will try to call ObjectStore->flush to make sure all pending IO done. But previous OSDMap committing IO may complete Context in OSD::_committed_osd_maps which need to acquire osd_lock firstly. So OSD shutdown thread need to wait for finisher done, and finisher is acquiring osd_lock. dead lock happended Signed-off-by: Haomai Wang --- src/osd/OSD.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 3dc490fea8b2..a6017a780f3f 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -6833,11 +6833,11 @@ void OSD::handle_osd_map(MOSDMap *m) void OSD::_committed_osd_maps(epoch_t first, epoch_t last, MOSDMap *m) { dout(10) << __func__ << " " << first << ".." << last << dendl; - Mutex::Locker l(osd_lock); if (is_stopping()) { dout(10) << __func__ << " bailing, we are shutting down" << dendl; return; } + Mutex::Locker l(osd_lock); map_lock.get_write(); bool do_shutdown = false; -- 2.47.3