void FileJournal::start_writer()
{
write_stop = false;
+ aio_stop = false;
write_thread.create();
#ifdef HAVE_LIBAIO
write_finish_thread.create();
{
{
Mutex::Locker l(write_lock);
-#ifdef HAVE_LIBAIO
- Mutex::Locker q(aio_lock);
-#endif
Mutex::Locker p(writeq_lock);
write_stop = true;
writeq_cond.Signal();
+ }
+ write_thread.join();
+
#ifdef HAVE_LIBAIO
+ // stop aio completeion thread *after* writer thread has stopped
+ // and has submitted all of its io
+ if (aio) {
+ aio_lock.Lock();
+ aio_stop = true;
aio_cond.Signal();
write_finish_cond.Signal();
-#endif
- }
- write_thread.join();
-#ifdef HAVE_LIBAIO
- write_finish_thread.join();
+ aio_lock.Unlock();
+ write_finish_thread.join();
+ }
#endif
}
{
Mutex::Locker locker(aio_lock);
if (aio_queue.empty()) {
- if (write_stop)
+ if (aio_stop)
break;
dout(20) << "write_finish_thread_entry sleeping" << dendl;
write_finish_cond.Wait(aio_lock);
// write thread
Mutex write_lock;
bool write_stop;
+ bool aio_stop;
Cond commit_cond;
throttle_bytes(g_ceph_context, "filestore_bytes"),
write_lock("FileJournal::write_lock", false, true, false, g_ceph_context),
write_stop(false),
+ aio_stop(false),
write_thread(this),
write_finish_thread(this) { }
~FileJournal() {