Proposal for adding O_DIRECT support into JDK 9

Brian Burkhalter brian.burkhalter at oracle.com
Fri Sep 15 22:53:10 UTC 2017


Hi Lucy,

This change works:

--- a/test/java/nio/channels/FileChannel/directio/libDirectIO.c
+++ b/test/java/nio/channels/FileChannel/directio/libDirectIO.c
@@ -71,7 +71,7 @@
 
     const char* path = (*env)->GetStringUTFChars(env, file_path, JNI_FALSE);
 
-    int fd = open(path, 'r');
+    int fd = open(path, 'r', 0600);
 
     (*env)->ReleaseStringUTFChars(env, file_path, path);

All five tests pass in my Ubuntu 16.04 64-bit VM.

On my macOS system I also observed this failure:

java.lang.RuntimeException: DirectIO is not working properly with write. File still exists in cache!
        at DirectIOTest.main(DirectIOTest.java:117)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at com.sun.javatest.regtest.agent.MainActionHelper$SameVMRunnable.run(MainActionHelper.java:230)
        at java.base/java.lang.Thread.run(Thread.java:844)

Neither this nor the other failure on macOS occurs every time, i.e., they appear to be intermittent.

Thanks,

Brian

On Sep 15, 2017, at 3:45 PM, Lu, Yingqi <yingqi.lu at intel.com> wrote:

> Could you please replace the line 78 in jdk/test/java/nio/channels/FileChannel/directio/libDirectIO.c with the following line and give it a try on your Ubuntu box? I tested it on my CentOS system, it does not complain.
>  
>     int fd = open(path, 'r', 0600);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20170915/dd193128/attachment.html>


More information about the nio-dev mailing list