8009632: (fs) FileStore.supportsFileAttributeView does not detect user_xattr enabled on ext4

Brian Burkhalter brian.burkhalter at oracle.com
Thu Apr 12 17:39:19 UTC 2018


On Apr 12, 2018, at 4:08 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> On 12/04/2018 01:15, Brian Burkhalter wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8009632
>> 
>> Remove special case handling of ext3 and ext4 and perform the check programmatically. xattr is enabled by default on at least ext4 and in any case there seems to be no point in having this special case.
> It might be better to check for "nouser_xattr" so that there is no probing when extended attributes are disabled. Then you can return true if the file system is ext3 or ext4 and avoid probing for these cases.

Update:

--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java
@@ -140,10 +140,12 @@
             if ((entry().hasOption("user_xattr")))
                 return true;
 
-            // user_xattr option not present but we special-case ext3/4 as we
-            // know that extended attributes are not enabled by default.
-            if (entry().fstype().equals("ext3") || entry().fstype().equals("ext4"))
-                return false;
+            // for ext3 and ext4 user_xattr option is enabled by default so
+            // check for explicit disabling of this option
+            if (entry().fstype().equals("ext3") ||
+                entry().fstype().equals("ext4")) {
+                return !entry().hasOption("nouser_xattr");
+            }
 
             // not ext3/4 so probe mount point
             if (!xattrChecked) {

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180412/121977b4/attachment-0001.html>


More information about the nio-dev mailing list