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

Code improvement for FSN#checkUnreadableBySuperuser

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.6.0
    • 2.7.0
    • namenode
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: