Skip to content

Commit

Permalink
os/FileJournal: For journal-aio-mode, don't use aio when closing jour…
Browse files Browse the repository at this point in the history
…nal.

For jouranl-aio-mode when closing journal, the write_finish_thread_entry may exit before
write_thread_entry. This cause no one wait last aios to complete.
On some platform, after that the journal-header on journal corrupted.
To avoid this, when closing jouranl we don't use aio.

Fixes: 9073
Reported-by: Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
Tested-by: Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
Signed-off-by: Ma Jianpeng <jianpeng.ma@intel.com>
(cherry picked from commit e870fd0)
  • Loading branch information
majianpeng authored and liewegas committed Oct 21, 2014
1 parent dbc33fb commit ecff376
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/os/FileJournal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,9 @@ void FileJournal::write_thread_entry()
}

#ifdef HAVE_LIBAIO
if (aio) {
//We hope write_finish_thread_entry return until the last aios complete
//when set write_stop. But it can't. So don't use aio mode when shutdown.
if (aio && !write_stop) {
Mutex::Locker locker(aio_lock);
// should we back off to limit aios in flight? try to do this
// adaptively so that we submit larger aios once we have lots of
Expand Down Expand Up @@ -1176,7 +1178,7 @@ void FileJournal::write_thread_entry()
}

#ifdef HAVE_LIBAIO
if (aio)
if (aio && !write_stop)
do_aio_write(bl);
else
do_write(bl);
Expand Down

0 comments on commit ecff376

Please sign in to comment.