HADOOP-12776. Remove getaclstatus call for non-acl commands in getfacl. 
(Contributed by Brahma Reddy Battula)

(cherry picked from commit c78740a979c1b434c6595b302bd376fc3d432509)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/488e6cbe
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/488e6cbe
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/488e6cbe

Branch: refs/heads/branch-2
Commit: 488e6cbe16140f8e93bbf9a4c512211680c21777
Parents: 7f1d18f
Author: Vinayakumar B <vinayakum...@apache.org>
Authored: Fri Feb 12 11:53:28 2016 +0530
Committer: Vinayakumar B <vinayakum...@apache.org>
Committed: Fri Feb 12 11:55:16 2016 +0530

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt         |  3 +++
 .../java/org/apache/hadoop/fs/shell/AclCommands.java    | 12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/488e6cbe/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt 
b/hadoop-common-project/hadoop-common/CHANGES.txt
index 27dc467..0ab6d74 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

http://git-wip-us.apache.org/repos/asf/hadoop/blob/488e6cbe/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/AclCommands.java
----------------------------------------------------------------------
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 d139eba..42829bf 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<AclEntry> entries = perm.getAclBit() ? aclStatus.getEntries()
-          : Collections.<AclEntry> emptyList();
+      AclStatus aclStatus = null;
+      List<AclEntry> entries = null;
+      if (perm.getAclBit()) {
+        aclStatus = item.fs.getAclStatus(item.path);
+        entries = aclStatus.getEntries();
+      } else {
+        aclStatus = null;
+        entries = Collections.<AclEntry> emptyList();
+      }
       ScopedAclEntries scopedEntries = new ScopedAclEntries(
         AclUtil.getAclFromPermAndEntries(perm, entries));
       printAclEntriesForSingleScope(aclStatus, perm,

Reply via email to