{"record":{"id":"bdfb2507c07dd914","repo":"apache/hadoop","slug":"getxattr-on-path-path-is-not-within-a-mount-po","errorCode":null,"errorMessage":"getXAttr on path `<path>' is not within a mount point","messagePattern":"getXAttr on path `<path>' is not within a mount point","errorType":"exception","errorClass":"NotInMountpointException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java","lineNumber":1840,"sourceCode":"    @Override\n    public AclStatus getAclStatus(Path path) throws IOException {\n      checkPathIsSlash(path);\n      return new AclStatus.Builder().owner(ugi.getShortUserName())\n          .group(ugi.getPrimaryGroupName())\n          .addEntries(AclUtil.getMinimalAcl(PERMISSION_555))\n          .stickyBit(false).build();\n    }\n\n    @Override\n    public void setXAttr(Path path, String name, byte[] value,\n        EnumSet<XAttrSetFlag> flag) throws IOException {\n      checkPathIsSlash(path);\n      throw readOnlyMountTable(\"setXAttr\", path);\n    }\n\n    @Override\n    public byte[] getXAttr(Path path, String name) throws IOException {\n      throw new NotInMountpointException(path, \"getXAttr\");\n    }\n\n    @Override\n    public Map<String, byte[]> getXAttrs(Path path) throws IOException {\n      throw new NotInMountpointException(path, \"getXAttrs\");\n    }\n\n    @Override\n    public Map<String, byte[]> getXAttrs(Path path, List<String> names)\n        throws IOException {\n      throw new NotInMountpointException(path, \"getXAttrs\");\n    }\n\n    @Override\n    public List<String> listXAttrs(Path path) throws IOException {\n      throw new NotInMountpointException(path, \"listXAttrs\");\n    }\n","sourceCodeStart":1822,"sourceCodeEnd":1858,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java#L1822-L1858","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run getfattr/getXAttr on mounted paths (real files/dirs in a backing cluster)","Add linkMergeSlash so '/' maps to a real file system and root-level xattrs resolve","Skip internal dirs in xattr-walking code by catching NotInMountpointException (a UnsupportedOperationException)","Adjust scanners to enumerate mounts and query each target cluster directly"],"exampleFix":"// before\nbyte[] v = fs.getXAttr(new Path(\"/\"), \"user.tag\"); // internal dir -> throws\n\n// after\nbyte[] v;\ntry {\n  v = fs.getXAttr(new Path(\"/data/hdfs\"), \"user.tag\");\n} catch (UnsupportedOperationException e) {\n  v = null; // mount-table directory: no xattrs\n}","handlingStrategy":"try-catch","validationCode":"// Only read xattrs on mounted paths\nPath mounted = new Path(\"viewfs://cluster/data/hdfs\");\nbyte[] v = fs.getXAttr(mounted, \"user.tag\");","typeGuard":null,"tryCatchPattern":"try {\n  v = fs.getXAttr(p, name);\n} catch (UnsupportedOperationException e) {\n  v = null; // p is a mount-table internal dir; xattrs live on target FS only\n}","preventionTips":["Skip virtual directories in xattr/security scans","Query target clusters directly for encryption-zone and policy xattrs","Use linkMergeSlash if root-level xattr probes must succeed"],"tags":["viewfs","hadoop","xattr","mount-table","internal-dir"],"backgroundTag":"viewfs-not-in-mountpoint","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}