]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileJournal: For journal-aio-mode, don't use aio when closing journal.
authorMa Jianpeng <jianpeng.ma@intel.com>
Thu, 21 Aug 2014 07:10:46 +0000 (15:10 +0800)
committerSage Weil <sage@redhat.com>
Thu, 21 Aug 2014 15:21:39 +0000 (08:21 -0700)
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>
src/os/FileJournal.cc

index a3305fba066677837b135988b023decd5fe03953..e510e28adb19c7dea89c50d0706e25b8d23530ba 100644 (file)
@@ -1114,7 +1114,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
@@ -1165,7 +1167,7 @@ void FileJournal::write_thread_entry()
     }
 
 #ifdef HAVE_LIBAIO
-    if (aio)
+    if (aio && !write_stop)
       do_aio_write(bl);
     else
       do_write(bl);