diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2013-04-05 14:48:13 +0800 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2013-05-28 13:57:21 +0800 |
commit | 0c1ca8edda43b39878c29d65a577691db7e49a08 (patch) | |
tree | 8a92b4ab57a9de091e652d84b7aead4e10406d06 | |
parent | 5426c75d7b564b87ed14a9a0a4f7c3262a81668c (diff) | |
download | ceph-0c1ca8edda43b39878c29d65a577691db7e49a08.tar.gz |
mds: fix uncommitted master wait
We may add new waiter while the master is committing. so we should
take the waiters and wake up them when the master is committed.
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r-- | src/mds/MDCache.cc | 23 | ||||
-rw-r--r-- | src/mds/MDCache.h | 2 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index cc661f21486..24ef1cd8db8 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -2144,32 +2144,27 @@ void MDCache::predirty_journal_parents(Mutation *mut, EMetaBlob *blob, struct C_MDC_CommittedMaster : public Context { MDCache *cache; metareqid_t reqid; - LogSegment *ls; - list<Context*> waiters; - C_MDC_CommittedMaster(MDCache *s, metareqid_t r, LogSegment *l, list<Context*> &w) : - cache(s), reqid(r), ls(l) { - waiters.swap(w); - } + C_MDC_CommittedMaster(MDCache *s, metareqid_t r) : cache(s), reqid(r) {} void finish(int r) { - cache->_logged_master_commit(reqid, ls, waiters); + cache->_logged_master_commit(reqid); } }; void MDCache::log_master_commit(metareqid_t reqid) { dout(10) << "log_master_commit " << reqid << dendl; + uncommitted_masters[reqid].committing = true; mds->mdlog->start_submit_entry(new ECommitted(reqid), - new C_MDC_CommittedMaster(this, reqid, - uncommitted_masters[reqid].ls, - uncommitted_masters[reqid].waiters)); - mds->mdcache->uncommitted_masters.erase(reqid); + new C_MDC_CommittedMaster(this, reqid)); } -void MDCache::_logged_master_commit(metareqid_t reqid, LogSegment *ls, list<Context*> &waiters) +void MDCache::_logged_master_commit(metareqid_t reqid) { dout(10) << "_logged_master_commit " << reqid << dendl; - ls->uncommitted_masters.erase(reqid); - mds->queue_waiters(waiters); + assert(uncommitted_masters.count(reqid)); + uncommitted_masters[reqid].ls->uncommitted_masters.erase(reqid); + mds->queue_waiters(uncommitted_masters[reqid].waiters); + uncommitted_masters.erase(reqid); } // while active... diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index d837586a3ac..c41692b5169 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -291,7 +291,7 @@ public: } void log_master_commit(metareqid_t reqid); void logged_master_update(metareqid_t reqid); - void _logged_master_commit(metareqid_t reqid, LogSegment *ls, list<Context*> &waiters); + void _logged_master_commit(metareqid_t reqid); void committed_master_slave(metareqid_t r, int from); void finish_committed_masters(); |