You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Yi Liu (JIRA)" <ji...@apache.org> on 2014/10/14 10:23:34 UTC

[jira] [Created] (HDFS-7242) Code improvement for FSN#checkUnreadableBySuperuser

Yi Liu created HDFS-7242:
----------------------------

             Summary: Code improvement for FSN#checkUnreadableBySuperuser
                 Key: HDFS-7242
                 URL: https://issues.apache.org/jira/browse/HDFS-7242
             Project: Hadoop HDFS
          Issue Type: Improvement
          Components: namenode
    Affects Versions: 2.6.0
            Reporter: Yi Liu
            Assignee: Yi Liu
            Priority: Minor


_checkUnreadableBySuperuser_ is to check whether user can access specific path. The code logic is not efficient. It does iteration check for all user, actually we just need to check _super user_ and can save few cpu cycle.
{code}
private void checkUnreadableBySuperuser(FSPermissionChecker pc,
      INode inode, int snapshotId)
      throws IOException {
    for (XAttr xattr : dir.getXAttrs(inode, snapshotId)) {
      if (XAttrHelper.getPrefixName(xattr).
          equals(SECURITY_XATTR_UNREADABLE_BY_SUPERUSER)) {
        if (pc.isSuperUser()) {
          throw new AccessControlException("Access is denied for " +
              pc.getUser() + " since the superuser is not allowed to " +
              "perform this operation.");
        }
      }
    }
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)