]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix blocking in standby replay thread
authorSage Weil <sage@newdream.net>
Thu, 1 Dec 2011 17:17:38 +0000 (09:17 -0800)
committerSage Weil <sage@newdream.net>
Thu, 1 Dec 2011 17:17:56 +0000 (09:17 -0800)
We need to hold mylock before waiting on the cond or else we get

./common/Cond.h: In function 'int Cond::Wait(Mutex&)', in thread '7f37fe0c8700'
./common/Cond.h: 46: FAILED assert(mutex.is_locked())
 ceph version 0.38-2-g73f99a1 (commit:73f99a189f491866da2be88adcfe0bd512282755)
 1: (MDLog::_replay_thread()+0x2483) [0x6c4393]
 2: (MDLog::ReplayThread::entry()+0xd) [0x4decbd]
 3: (()+0x6d8c) [0x7f3803e8fd8c]
 4: (clone()+0x6d) [0x7f38028d504d]
 ceph version 0.38-2-g73f99a1 (commit:73f99a189f491866da2be88adcfe0bd512282755)
 1: (MDLog::_replay_thread()+0x2483) [0x6c4393]
 2: (MDLog::ReplayThread::entry()+0xd) [0x4decbd]
 3: (()+0x6d8c) [0x7f3803e8fd8c]
 4: (clone()+0x6d) [0x7f38028d504d]
*** Caught signal (Aborted) **
 in thread 7f37fe0c8700

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/MDLog.cc

index 40784d1df1e100da39b8ca289160e5b615e599fd..de1619e1ac45c4162899f76d0ee76fd2e0fff9a3 100644 (file)
@@ -497,8 +497,10 @@ void MDLog::_replay_thread()
           int err = 0;
           journaler->reread_head(new C_SafeCond(&mylock, &cond, &done, &err));
           mds->mds_lock.Unlock();
+         mylock.Lock();
           while (!done)
             cond.Wait(mylock);
+         mylock.Unlock();
           if (err) { // well, crap
             dout(0) << "got error while reading head: " << cpp_strerror(err)
                     << dendl;