hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ayushsax...@apache.org
Subject [hadoop] branch trunk updated: HDFS-15091. Cache Admin and Quota Commands Should Check SuperUser Before Taking Lock. Contributed by Ayush Saxena.
Date Sat, 04 Jan 2020 13:43:48 GMT
This is an automated email from the ASF dual-hosted git repository.

ayushsaxena pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f8644fb  HDFS-15091. Cache Admin and Quota Commands Should Check SuperUser Before
Taking Lock. Contributed by Ayush Saxena.
f8644fb is described below

commit f8644fbe9f76fb2990bcc997a346649e4d432d91
Author: Ayush Saxena <ayushsaxena@apache.org>
AuthorDate: Sat Jan 4 19:02:59 2020 +0530

    HDFS-15091. Cache Admin and Quota Commands Should Check SuperUser Before Taking Lock.
Contributed by Ayush Saxena.
---
 .../org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java |  3 ---
 .../apache/hadoop/hdfs/server/namenode/FSNDNCacheOp.java    | 13 -------------
 .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java    |  4 ++++
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java
index 65b528a..43b9fee 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java
@@ -233,9 +233,6 @@ public class FSDirAttrOp {
    */
   static void setQuota(FSDirectory fsd, FSPermissionChecker pc, String src,
       long nsQuota, long ssQuota, StorageType type) throws IOException {
-    if (fsd.isPermissionEnabled()) {
-      pc.checkSuperuserPrivilege();
-    }
 
     fsd.writeLock();
     try {
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNDNCacheOp.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNDNCacheOp.java
index 093ee74..1badbd1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNDNCacheOp.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNDNCacheOp.java
@@ -78,11 +78,6 @@ class FSNDNCacheOp {
       FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req,
       boolean logRetryCache)
       throws IOException {
-    final FSPermissionChecker pc = getFsPermissionChecker(fsn);
-
-    if (pc != null) {
-      pc.checkSuperuserPrivilege();
-    }
     CachePoolInfo info = cacheManager.addCachePool(req);
     fsn.getEditLog().logAddCachePool(info, logRetryCache);
     return info;
@@ -91,10 +86,6 @@ class FSNDNCacheOp {
   static void modifyCachePool(
       FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req,
       boolean logRetryCache) throws IOException {
-    final FSPermissionChecker pc = getFsPermissionChecker(fsn);
-    if (pc != null) {
-      pc.checkSuperuserPrivilege();
-    }
     cacheManager.modifyCachePool(req);
     fsn.getEditLog().logModifyCachePool(req, logRetryCache);
   }
@@ -102,10 +93,6 @@ class FSNDNCacheOp {
   static void removeCachePool(
       FSNamesystem fsn, CacheManager cacheManager, String cachePoolName,
       boolean logRetryCache) throws IOException {
-    final FSPermissionChecker pc = getFsPermissionChecker(fsn);
-    if (pc != null) {
-      pc.checkSuperuserPrivilege();
-    }
     cacheManager.removeCachePool(cachePoolName);
     fsn.getEditLog().logRemoveCachePool(cachePoolName, logRetryCache);
   }
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
index b626271..69f0799 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
@@ -3378,6 +3378,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     final String operationName = getQuotaCommand(nsQuota, ssQuota);
     final FSPermissionChecker pc = getPermissionChecker();
     try {
+      checkSuperuserPrivilege(pc);
       writeLock();
       try {
         checkOperation(OperationCategory.WRITE);
@@ -7197,6 +7198,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     checkOperation(OperationCategory.WRITE);
     String poolInfoStr = null;
     try {
+      checkSuperuserPrivilege();
       writeLock();
       try {
         checkOperation(OperationCategory.WRITE);
@@ -7223,6 +7225,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     String poolNameStr = "{poolName: " +
         (req == null ? null : req.getPoolName()) + "}";
     try {
+      checkSuperuserPrivilege();
       writeLock();
       try {
         checkOperation(OperationCategory.WRITE);
@@ -7248,6 +7251,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
     checkOperation(OperationCategory.WRITE);
     String poolNameStr = "{poolName: " + cachePoolName + "}";
     try {
+      checkSuperuserPrivilege();
       writeLock();
       try {
         checkOperation(OperationCategory.WRITE);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message