apache/hadoop · error · UnsupportedOperationException

ACLs are not supported on symlinks

Error message

ACLs are not supported on symlinks

What it means

INodeSymlink.removeAclFeature unconditionally throws UnsupportedOperationException("ACLs are not supported on symlinks"). HDFS attaches ACL features only to files and directories; any ACL-removal code path whose INode is a symlink terminates here. It is by design, not corruption — HDFS simply has no ACL representation for symlink inodes.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeSymlink.java:119

    return summary;
  }

  @Override
  public void dumpTreeRecursively(PrintWriter out, StringBuilder prefix,
      final int snapshot) {
    super.dumpTreeRecursively(out, prefix, snapshot);
    out.print(" ~> ");
    out.println(getSymlinkString());
  }

  @Override
  public void accept(NamespaceVisitor visitor, int snapshot) {
    visitor.visitSymlink(this, snapshot);
  }

  @Override
  public void removeAclFeature() {
    throw new UnsupportedOperationException("ACLs are not supported on symlinks");
  }

  @Override
  public void addAclFeature(AclFeature f) {
    throw new UnsupportedOperationException("ACLs are not supported on symlinks");
  }

  @Override
  final XAttrFeature getXAttrFeature(int snapshotId) {
    throw new UnsupportedOperationException("XAttrs are not supported on symlinks");
  }
  
  @Override
  public void removeXAttrFeature() {
    throw new UnsupportedOperationException("XAttrs are not supported on symlinks");
  }
  
  @Override

View on GitHub (pinned to 2add963021)

Solutions

  1. Skip symlinks when removing ACLs — filter with FileStatus.isSymlink() during traversal
  2. If the intent is to manage ACLs of the destination, resolve the link target and operate on that path
  3. Wrap per-entry operations so one symlink does not abort the whole batch

Example fix

# before
for p in $(hdfs dfs -ls -R /data | awk '{print $NF}'); do
  hdfs dfs -setfacl -b "$p"   # fails on symlinks
# -> UnsupportedOperationException: ACLs are not supported on symlinks

# after
for p in $(hdfs dfs -ls -R /data | grep -v '^l' | awk '{print $NF}'); do
  hdfs dfs -setfacl -b "$p" || echo "skipped $p"
done
Defensive patterns

Strategy: type-guard

Validate before calling

// Before removeAcl over a tree, filter links
FileStatus st = fs.getFileStatus(p);
if (st.isSymlink()) { continue; }
fs.removeAcl(p);

Type guard

boolean canHaveAcl(FileSystem fs, Path p) throws IOException {
  FileStatus st = fs.getFileStatus(p);
  return !st.isSymlink();   // files and directories support ACLs
}

Try / catch

catch (UnsupportedOperationException e) {
  if (e.getMessage() != null && e.getMessage().contains("symlinks")) {
    skipAndRecord(path);    // HDFS design limit: skip links, keep processing
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: removeAcl on a path that is a symlink (DFS API, WebHDFS setAcl/removeAcl); recursive ACL-stripping tools that do not skip symlinks; internal code calling removeAclFeature directly on an INode recovered from the namespace.

Common situations: Bulk ACL migration/normalization scripts walking trees that contain symlinks; compliance tooling that applies uniform ACLs across a subtree; distcp preserving ACLs onto trees with links.

Related errors


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