From: Jens Axboe Date: Sat, 10 Feb 2007 11:57:55 +0000 (+0100) Subject: [PATCH] Fix libaio engine SYNC X-Git-Tag: fio-1.12~116 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=e5c40aabb82b796e34f2ea7a184a3f72f5fb41e5 [PATCH] Fix libaio engine SYNC io_prep_fsync() isn't supported at all in Linux currently, so fall back to fsync() if we get an -EINVAL return value. Signed-off-by: Jens Axboe --- diff --git a/engines/libaio.c b/engines/libaio.c index 9a644f6f..c9560054 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -82,7 +82,17 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u) usleep(100); else if (ret == -EINTR) continue; - else + else if (ret == -EINVAL && io_u->ddir == DDIR_SYNC) { + /* + * the async fsync doesn't currently seem to be + * supported, so just fsync if we fail with EINVAL + * for a sync. since buffered io is also sync + * with libaio (still), we don't have pending + * requests to flush first. + */ + ret = fsync(io_u->file->fd); + break; + } else break; } while (1);