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

(fs) Cannot obtain FileStore if device of path is not in /proc/mounts

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd_major
    • Component/s: core-libs
    • Labels:
      None

      Description

      If the class GetFileStore included below is for example run in a chroot environment it will fail with an IOException whose message is "Mount point not found".

      import java.nio.file.Files;
      import java.nio.file.FileStore;
      import java.nio.file.Path;
      import java.nio.file.Paths;

      public class GetFileStore {
          public static void main(String[] args) throws Throwable {
              String userDir = System.getProperty("user.dir");
              System.out.printf("Retrieving FileStore for %s%n", userDir);
              Path path = Paths.get(userDir);
              FileStore fileStore = Files.getFileStore(path);
              System.out.printf("%s is in FileStore %s of type %s%n",
                                userDir, fileStore.name(), fileStore.type());
          }
      }

      For example if /proc/mounts contains only

      none /proc proc rw,relatime 0 0

      running the above class within /home behaves as follows:

      /home# java GetFileStore
      Retrieving FileStore for /home
      Exception in thread "main" java.io.IOException: Mount point not found
      at sun.nio.fs.LinuxFileStore.findMountEntry(java.base/LinuxFileStore.java:91)
      at sun.nio.fs.UnixFileStore.<init>(java.base/UnixFileStore.java:65)
      at sun.nio.fs.LinuxFileStore.<init>(java.base/LinuxFileStore.java:44)
      at sun.nio.fs.LinuxFileSystemProvider.getFileStore(java.base/LinuxFileSystemProvider.java:51)
      at sun.nio.fs.LinuxFileSystemProvider.getFileStore(java.base/LinuxFileSystemProvider.java:39)
      at sun.nio.fs.UnixFileSystemProvider.getFileStore(java.base/UnixFileSystemProvider.java:369)
      at java.nio.file.Files.getFileStore(java.base/Files.java:1464)
      at GetFileStore.main(GetFileStore.java:11)

        Issue Links

          Activity

          Hide
          bpb Brian Burkhalter added a comment -
          RFC thread regarding various situations in which this problem has been observed:
          http://mail.openjdk.java.net/pipermail/nio-dev/2016-October/003915.html
          Show
          bpb Brian Burkhalter added a comment - RFC thread regarding various situations in which this problem has been observed: http://mail.openjdk.java.net/pipermail/nio-dev/2016-October/003915.html
          Hide
          ksrini Kumar Srinivasan added a comment -
          I am also running into this, in a docker/container.
          Show
          ksrini Kumar Srinivasan added a comment - I am also running into this, in a docker/container.
          Hide
          alanb Alan Bateman added a comment -
          Does JDK-8165852 resolve this issue?
          Show
          alanb Alan Bateman added a comment - Does JDK-8165852 resolve this issue?
          Hide
          bpb Brian Burkhalter added a comment -
          This issue has not been resolved. The test class in the description output is

          Retrieving FileStore for /home/bpb
          Exception in thread "main" java.io.IOException: Mount point not found
          at java.base/sun.nio.fs.LinuxFileStore.findMountEntry(LinuxFileStore.java:100)
          at java.base/sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:65)
          at java.base/sun.nio.fs.LinuxFileStore.<init>(LinuxFileStore.java:44)
          at java.base/sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:51)
          at java.base/sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:39)
          at java.base/sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:369)
          at java.base/java.nio.file.Files.getFileStore(Files.java:1479)
          at GetFileStore.main(GetFileStore.java:11)

          The content of /proc/mounts is

          proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

          where the /proc filesystem was bound to the chroot using

          sudo mount -o bind /proc /var/chroot/proc
          Show
          bpb Brian Burkhalter added a comment - This issue has not been resolved. The test class in the description output is Retrieving FileStore for /home/bpb Exception in thread "main" java.io.IOException: Mount point not found at java.base/sun.nio.fs.LinuxFileStore.findMountEntry(LinuxFileStore.java:100) at java.base/sun.nio.fs.UnixFileStore.<init>(UnixFileStore.java:65) at java.base/sun.nio.fs.LinuxFileStore.<init>(LinuxFileStore.java:44) at java.base/sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:51) at java.base/sun.nio.fs.LinuxFileSystemProvider.getFileStore(LinuxFileSystemProvider.java:39) at java.base/sun.nio.fs.UnixFileSystemProvider.getFileStore(UnixFileSystemProvider.java:369) at java.base/java.nio.file.Files.getFileStore(Files.java:1479) at GetFileStore.main(GetFileStore.java:11) The content of /proc/mounts is proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 where the /proc filesystem was bound to the chroot using sudo mount -o bind /proc /var/chroot/proc

            People

            • Assignee:
              bpb Brian Burkhalter
              Reporter:
              bpb Brian Burkhalter
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: