Fix O_DIRECT memory alignment
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index f6ed89f2cc7fc78644ded12a3090e3083754d4a8..aabfee6544c2cda3c7228927500e77548d7440a6 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -799,7 +799,7 @@ static int init_io_u(struct thread_data *td)
        if (allocate_io_mem(td))
                return 1;
 
-       if (td->o.mem_align)
+       if (td->o.odirect || td->o.mem_align)
                p = PAGE_ALIGN(td->orig_buffer) + td->o.mem_align;
        else
                p = td->orig_buffer;
@@ -1500,7 +1500,13 @@ static void run_threads(void)
                                        *fio_debug_jobp = pid;
                        }
                        dprint(FD_MUTEX, "wait on startup_mutex\n");
-                       fio_mutex_down(startup_mutex);
+                       if (fio_mutex_down_timeout(startup_mutex, 10)) {
+                               log_err("fio: job startup hung? exiting.\n");
+                               terminate_threads(TERMINATE_ALL);
+                               fio_abort = 1;
+                               nr_started--;
+                               break;
+                       }
                        dprint(FD_MUTEX, "done waiting on startup_mutex\n");
                }