diff options
author | Sage Weil <sage@newdream.net> | 2008-10-08 18:47:37 +0200 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2008-10-08 18:47:48 +0200 |
commit | b3d6eef6a9da15ef33fc9949779bf8ec03a84b64 (patch) | |
tree | 67022690e8b55578ef17beded86e98887b7ce9e4 /src/os/JournalingObjectStore.h | |
parent | debian: include crun in osd, mds, mon packages (diff) | |
download | ceph-b3d6eef6a9da15ef33fc9949779bf8ec03a84b64.tar.xz ceph-b3d6eef6a9da15ef33fc9949779bf8ec03a84b64.zip |
journal: protect journal access (namely, completions) with mutex
The commit_waiters map was getting corrupted occasionally.
Diffstat (limited to '')
-rw-r--r-- | src/os/JournalingObjectStore.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/os/JournalingObjectStore.h b/src/os/JournalingObjectStore.h index b4f1c661f46..4b70ef9e482 100644 --- a/src/os/JournalingObjectStore.h +++ b/src/os/JournalingObjectStore.h @@ -28,6 +28,7 @@ protected: map<version_t, vector<Context*> > commit_waiters; RWLock op_lock; Mutex journal_lock; + Mutex lock; void journal_start() { finisher.start(); @@ -58,12 +59,16 @@ protected: op_lock.get_write(); } void commit_started() { + Mutex::Locker l(lock); + // allow new ops // (underlying fs should now be committing all prior ops) committing_op_seq = op_seq; op_lock.put_write(); } void commit_finish() { + Mutex::Locker l(lock); + if (journal) journal->committed_thru(committing_op_seq); @@ -76,11 +81,15 @@ protected: } void queue_commit_waiter(Context *oncommit) { + Mutex::Locker l(lock); + if (oncommit) commit_waiters[op_seq].push_back(oncommit); } void journal_transaction(bufferlist& tbl, Context *onsafe) { + Mutex::Locker l(lock); + ++op_seq; if (journal && journal->is_writeable()) { journal->submit_entry(op_seq, tbl, onsafe); |