diff mbox

[3/3] aio: always check paio_init result

Message ID 1311790322-10889-4-git-send-email-freddy77@gmail.com
State New
Headers show

Commit Message

Frediano Ziglio July 27, 2011, 6:12 p.m. UTC
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
---
 block/raw-posix.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 275b41e..3c6bd4b 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -230,13 +230,15 @@  static int raw_open_common(BlockDriverState *bs, const char *filename,
         }
     }
 
+    /* We're falling back to POSIX AIO in some cases so init always */
+    if (paio_init() < 0) {
+        goto out_free_buf;
+    }
+
 #ifdef CONFIG_LINUX_AIO
     if ((bdrv_flags & (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) ==
                       (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) {
 
-        /* We're falling back to POSIX AIO in some cases */
-        paio_init();
-
         s->aio_ctx = laio_init();
         if (!s->aio_ctx) {
             goto out_free_buf;
@@ -245,9 +247,6 @@  static int raw_open_common(BlockDriverState *bs, const char *filename,
     } else
 #endif
     {
-        if (paio_init() < 0) {
-            goto out_free_buf;
-        }
 #ifdef CONFIG_LINUX_AIO
         s->use_aio = 0;
 #endif