hadoop-hdfs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yi Liu (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HDFS-7242) Code improvement for FSN#checkUnreadableBySuperuser
Date Tue, 14 Oct 2014 08:23:34 GMT
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)

Mime
View raw message