Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8009632

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

XMLWordPrintable

    • b10
    • Not verified

      FULL PRODUCT VERSION :
      java version " 1.7.0_13 "
      Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux kernel 3.4 and later

      A DESCRIPTION OF THE PROBLEM :
      LinuxFileStore has a special case for ext4 when determining extended attribute support - it scrapes /proc/mounts to examine for the user_xattr mount option. However, in recent kernels, user_xattr was made a default, and this git commit to ext4 changes /proc/mounts to no longer display user_xattr in the mount options:

      commit 5a916be1b31de9e833aa764de6faf27bb79f9b83
      Author: Theodore Ts'o <tytso@mit.edu>
      Date: Sun Mar 4 19:27:31 2012 -0500

          ext4: make ext4_show_options() be table-driven
          
          Consistently show mount options which are the non-default, so that
          /proc/mounts accurately shows the mount options that would be
          necessary to mount the file system in its current mode of operation.
          
          Signed-off-by: " Theodore Ts'o " <tytso@mit.edu>

      The result is that java does not correctly determine that the filesystem has extended attribute support.

      This commit was pushed to the Linux kernel as part of the 3.4 merge window. I have only tested against 3.4 myself, but this may affect systems running any kernel 3.4 or later.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) javac extattr.java (see source code for test case)
      2) java extattr <filename of a file on an ext4 filesystem with extended attribute support enabled>


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.File;
      import java.nio.file.Files;

      #args[0] should be a file residing on an ext4 file system with extended attribute support enabled
      public class extattr {
         public static void main(String[] args) throws Exception {
            File file = new File(args[0]);
            System.out.println(Files.getFileStore(file.toPath()).supportsFileAttributeView( "user" ));
         }
      }

      ---------- END SOURCE ----------

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: