[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 <jens.axboe@oracle.com>
diff --git a/engines/libaio.c b/engines/libaio.c
index 9a644f6..c956005 100644
--- a/engines/libaio.c
+++ b/engines/libaio.c
@@ -82,7 +82,17 @@
 			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);