Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7242

Code improvement for FSN#checkUnreadableBySuperuser

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.7.0
    • Component/s: namenode
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      checkUnreadableBySuperuser is to check whether super 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.

      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.");
              }
            }
          }
        }
      

        Attachments

        1. HDFS-7242.001.patch
          1 kB
          Yi Liu

          Activity

            People

            • Assignee:
              hitliuyi Yi Liu
              Reporter:
              hitliuyi Yi Liu
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: