From 7c2eab19e2c088e97de924f7f1a633a9f291439d Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 1 Jul 2016 21:06:17 -0400 Subject: [PATCH] mds: move Finisher to unlocked shutdown This commit resolves a deadlock reported in i16042 where the thread calling MDSRankDispatcher::shutdown would hold the mds_lock while asynchronous callbacks in the Finisher would attempt to lock mds_lock. For simplicity, I merged the finisher stop with the messenger shutdown as both need the mds_lock dropped. Fixes: http://tracker.ceph.com/issues/16042 Signed-off-by: Patrick Donnelly (cherry picked from commit b1d6689b6cae579d5f1b2047fd3c653cda422454) Conflicts: src/mds/MDSRank.cc trivial conflict in MDSRankDispatcher::shutdown() --- src/mds/MDSRank.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 68ea33eb0b343..1b45597a3a4d3 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -222,8 +222,6 @@ void MDSRankDispatcher::shutdown() // threads block on IOs that require finisher to complete. mdlog->shutdown(); - finisher->stop(); // no flushing - // shut down cache mdcache->shutdown(); @@ -236,9 +234,17 @@ void MDSRankDispatcher::shutdown() progress_thread.shutdown(); + // release mds_lock for finisher/messenger threads (e.g. + // MDSDaemon::ms_handle_reset called from Messenger). + mds_lock.Unlock(); + + finisher->stop(); // no flushing + // shut down messenger messenger->shutdown(); + mds_lock.Lock(); + // Workaround unclean shutdown: HeartbeatMap will assert if // worker is not removed (as we do in ~MDS), but ~MDS is not // always called after suicide.