apache/hadoop · error · NotInMountpointException

getXAttr on path `<path>' is not within a mount point

Error message

getXAttr on path `<path>' is not within a mount point

What it means

ViewFileSystem.InternalDir.getXAttr(Path, String) serves xattr reads on paths that resolve to mount-table internal directories. Such dirs are client-side constructs with no storage, so the method unconditionally throws NotInMountpointException('getXAttr on path ... is not within a mount point') - extended attributes can only live on the target file system.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java:1840

    @Override
    public AclStatus getAclStatus(Path path) throws IOException {
      checkPathIsSlash(path);
      return new AclStatus.Builder().owner(ugi.getShortUserName())
          .group(ugi.getPrimaryGroupName())
          .addEntries(AclUtil.getMinimalAcl(PERMISSION_555))
          .stickyBit(false).build();
    }

    @Override
    public void setXAttr(Path path, String name, byte[] value,
        EnumSet<XAttrSetFlag> flag) throws IOException {
      checkPathIsSlash(path);
      throw readOnlyMountTable("setXAttr", path);
    }

    @Override
    public byte[] getXAttr(Path path, String name) throws IOException {
      throw new NotInMountpointException(path, "getXAttr");
    }

    @Override
    public Map<String, byte[]> getXAttrs(Path path) throws IOException {
      throw new NotInMountpointException(path, "getXAttrs");
    }

    @Override
    public Map<String, byte[]> getXAttrs(Path path, List<String> names)
        throws IOException {
      throw new NotInMountpointException(path, "getXAttrs");
    }

    @Override
    public List<String> listXAttrs(Path path) throws IOException {
      throw new NotInMountpointException(path, "listXAttrs");
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Run getfattr/getXAttr on mounted paths (real files/dirs in a backing cluster)
  2. Add linkMergeSlash so '/' maps to a real file system and root-level xattrs resolve
  3. Skip internal dirs in xattr-walking code by catching NotInMountpointException (a UnsupportedOperationException)
  4. Adjust scanners to enumerate mounts and query each target cluster directly

Example fix

// before
byte[] v = fs.getXAttr(new Path("/"), "user.tag"); // internal dir -> throws

// after
byte[] v;
try {
  v = fs.getXAttr(new Path("/data/hdfs"), "user.tag");
} catch (UnsupportedOperationException e) {
  v = null; // mount-table directory: no xattrs
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Only read xattrs on mounted paths
Path mounted = new Path("viewfs://cluster/data/hdfs");
byte[] v = fs.getXAttr(mounted, "user.tag");

Try / catch

try {
  v = fs.getXAttr(p, name);
} catch (UnsupportedOperationException e) {
  v = null; // p is a mount-table internal dir; xattrs live on target FS only
}

Prevention

When it happens

Trigger: Reading an xattr on '/' or a mount-parent directory: `hadoop fs -getfattr -d viewfs://cluster/`; Ranger/KMS/encryption-zone tooling probing xattrs (e.g. raw.* zone attributes) on viewfs dirs; distcp -p preserving xattrs when listing internal dirs.

Common situations: Security tooling ported from plain HDFS that checks encryption-zone or ACL-related xattrs at the namespace root; compliance scanners walking the whole tree after a viewfs cutover; audits that must now skip virtual directories.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/bdfb2507c07dd914. Report an issue: GitHub.