From 311b84aeb3f8eba70191353b4b9fe0a2576f9d95 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 10 Feb 2007 14:49:02 +0100 Subject: [PATCH] [PATCH] Make the libaio fsync fallback really work This time it's tested :-) Signed-off-by: Jens Axboe --- engines/libaio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/libaio.c b/engines/libaio.c index acc125f4..47c1d4b8 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -88,7 +88,7 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) do { ret = io_submit(ld->aio_ctx, 1, &iocb); if (ret == 1) - return 0; + break; else if (ret == -EAGAIN || !ret) usleep(100); else if (ret == -EINTR) @@ -101,8 +101,12 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) * with libaio (still), we don't have pending * requests to flush first. */ - ret = fsync(io_u->file->fd); - ld->sync_io_u = io_u; + if (fsync(io_u->file->fd) < 0) + ret = errno; + else { + ret = 1; + ld->sync_io_u = io_u; + } break; } else break; -- 2.25.1