disable directio for unaligned reads in Linux
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c
index ab86146..661ecaa 100644
--- a/src/os/unix/ngx_files.c
+++ b/src/os/unix/ngx_files.c
@@ -389,7 +389,7 @@
#if (NGX_HAVE_O_DIRECT)
ngx_int_t
-ngx_directio(ngx_fd_t fd)
+ngx_directio_on(ngx_fd_t fd)
{
int flags;
@@ -402,4 +402,19 @@
return fcntl(fd, F_SETFL, flags | O_DIRECT);
}
+
+ngx_int_t
+ngx_directio_off(ngx_fd_t fd)
+{
+ int flags;
+
+ flags = fcntl(fd, F_GETFL);
+
+ if (flags == -1) {
+ return -1;
+ }
+
+ return fcntl(fd, F_SETFL, flags & ~O_DIRECT);
+}
+
#endif