From: Greg Farnum Date: Wed, 1 May 2013 21:10:31 +0000 (-0700) Subject: dumper: fix Objecter locking X-Git-Tag: v0.61~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dfacd1bd805ebb730b5206c9830b28f47cc7f9cf;p=ceph.git dumper: fix Objecter locking Locking expectations changed at some point, and the Dumper wasn't updated to comply: 1) We need to take the lock for Objecter, as it doesn't do so on its own any more. 2) We need to drop the lock in several places so that Objecter can take delivery of messages Signed-off-by: Greg Farnum Reviewed-by: Sage Weil --- diff --git a/src/mds/Dumper.cc b/src/mds/Dumper.cc index 917403ee2088..9b83b4d9b002 100644 --- a/src/mds/Dumper.cc +++ b/src/mds/Dumper.cc @@ -25,6 +25,8 @@ #include "mon/MonClient.h" #include "osdc/Journaler.h" +#define dout_subsys ceph_subsys_mds + Dumper::~Dumper() { } @@ -69,9 +71,9 @@ void Dumper::init(int rank) objecter->init_unlocked(); lock.Lock(); objecter->init_locked(); + lock.Unlock(); objecter->wait_for_osd_map(); timer.init(); - lock.Unlock(); } void Dumper::shutdown() @@ -91,11 +93,14 @@ void Dumper::dump(const char *dump_file) int rank = strtol(g_conf->name.get_id().c_str(), 0, 0); inodeno_t ino = MDS_INO_LOG_OFFSET + rank; + Mutex localLock("dump:lock"); lock.Lock(); - journaler->recover(new C_SafeCond(&lock, &cond, &done, &r)); - while (!done) - cond.Wait(lock); + journaler->recover(new C_SafeCond(&localLock, &cond, &done, &r)); lock.Unlock(); + localLock.Lock(); + while (!done) + cond.Wait(localLock); + localLock.Unlock(); if (r < 0) { // Error derr << "error on recovery: " << cpp_strerror(r) << dendl; @@ -103,6 +108,8 @@ void Dumper::dump(const char *dump_file) // wait for messenger to finish messenger->wait(); shutdown(); + } else { + dout(10) << "completed journal recovery" << dendl; } uint64_t start = journaler->get_read_pos(); @@ -112,12 +119,14 @@ void Dumper::dump(const char *dump_file) Filer filer(objecter); bufferlist bl; - filer.read(ino, &journaler->get_layout(), CEPH_NOSNAP, - start, len, &bl, 0, new C_SafeCond(&lock, &cond, &done)); lock.Lock(); - while (!done) - cond.Wait(lock); + filer.read(ino, &journaler->get_layout(), CEPH_NOSNAP, + start, len, &bl, 0, new C_SafeCond(&localLock, &cond, &done)); lock.Unlock(); + localLock.Lock(); + while (!done) + cond.Wait(localLock); + localLock.Unlock(); cout << "read " << bl.length() << " bytes at offset " << start << std::endl; diff --git a/src/mds/Dumper.h b/src/mds/Dumper.h index 066ba5ccb1df..794ae0c8aa73 100644 --- a/src/mds/Dumper.h +++ b/src/mds/Dumper.h @@ -62,6 +62,7 @@ public: virtual ~Dumper(); bool ms_dispatch(Message *m) { + Mutex::Locker locker(lock); switch (m->get_type()) { case CEPH_MSG_OSD_OPREPLY: objecter->handle_osd_op_reply((MOSDOpReply *)m);