osd: fix watch timer, locking

This commit is contained in:
Yehuda Sadeh 2010-12-15 15:22:32 -08:00
parent e31f0a4783
commit 060fd42810
2 changed files with 8 additions and 1 deletions

View File

@ -459,6 +459,7 @@ int OSD::init()
Mutex::Locker lock(osd_lock);
timer.init();
watch_timer.init();
watch = new Watch();
// mount.
@ -654,6 +655,10 @@ int OSD::shutdown()
timer.shutdown();
watch_lock.Lock();
watch_timer.shutdown();
watch_lock.Unlock();
heartbeat_lock.Lock();
heartbeat_stop = true;
heartbeat_cond.Signal();
@ -1757,7 +1762,8 @@ void OSD::handle_notify_timeout(void *_notif)
ReplicatedPG *pg = (ReplicatedPG *)lookup_lock_raw_pg(notif->pgid);
pg_t pgid = notif->pgid;
pg->do_complete_notify(notif, obc);
put_object_context(obc, notif->pgid);
pg->put_object_context(obc);
pg->unlock();
watch_lock.Lock();
/* exiting with watch_lock held */

View File

@ -1222,6 +1222,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops,
Watch::Notification *notif = osd->watch->get_notif(op.watch.cookie);
if (!notif) {
osd->watch_lock.Unlock();
result = -EINVAL;
break;
}