8009632: (fs) FileStore.supportsFileAttributeView does not detect user_xattr enabled on ext4
authorbpb
Thu, 12 Apr 2018 14:03:46 -0700
changeset 49586 09905cd87bb2
parent 49585 cb18edeaeca7
child 49587 1a87516db0b7
8009632: (fs) FileStore.supportsFileAttributeView does not detect user_xattr enabled on ext4 Reviewed-by: alanb
src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java	Thu Apr 12 13:30:58 2018 -0700
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java	Thu Apr 12 14:03:46 2018 -0700
@@ -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) {