hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Lamb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-7242) Code improvement for FSN#checkUnreadableBySuperuser
Date Tue, 14 Oct 2014 17:07:34 GMT

    [ https://issues.apache.org/jira/browse/HDFS-7242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14171222#comment-14171222
] 

Charles Lamb commented on HDFS-7242:
------------------------------------

Good catch Yi. Non-binding +1 from me.


> 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
>         Attachments: HDFS-7242.001.patch
>
>
> _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.
> {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