From 488e6cbe16140f8e93bbf9a4c512211680c21777 Mon Sep 17 00:00:00 2001 From: Vinayakumar B Date: Fri, 12 Feb 2016 11:53:28 +0530 Subject: [PATCH] HADOOP-12776. Remove getaclstatus call for non-acl commands in getfacl. (Contributed by Brahma Reddy Battula) (cherry picked from commit c78740a979c1b434c6595b302bd376fc3d432509) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../java/org/apache/hadoop/fs/shell/AclCommands.java | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 27dc467bef3..0ab6d74e5b3 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -466,6 +466,9 @@ Release 2.8.0 - UNRELEASED HADOOP-12699. TestKMS#testKMSProvider intermittently fails during 'test rollover draining'. (Xiao Chen via wang) + HADOOP-12776. Remove getaclstatus call for non-acl commands in getfacl. + (Brahma Reddy Battula via vinayakumarb) + OPTIMIZATIONS HADOOP-11785. Reduce the number of listStatus operation in distcp diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java index d139ebadce3..42829bf3e8e 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java @@ -86,9 +86,15 @@ class AclCommands extends FsCommand { (perm.getOtherAction().implies(FsAction.EXECUTE) ? "t" : "T")); } - AclStatus aclStatus = item.fs.getAclStatus(item.path); - List entries = perm.getAclBit() ? aclStatus.getEntries() - : Collections. emptyList(); + AclStatus aclStatus = null; + List entries = null; + if (perm.getAclBit()) { + aclStatus = item.fs.getAclStatus(item.path); + entries = aclStatus.getEntries(); + } else { + aclStatus = null; + entries = Collections. emptyList(); + } ScopedAclEntries scopedEntries = new ScopedAclEntries( AclUtil.getAclFromPermAndEntries(perm, entries)); printAclEntriesForSingleScope(aclStatus, perm,